Knight of the round table

          wansong

          使用開源Grid平臺-GridGain實現(xiàn)網(wǎng)格計算

          網(wǎng)格計算一般分為兩種:數(shù)據(jù)網(wǎng)格和計算網(wǎng)格,簡單的說數(shù)據(jù)網(wǎng)格就是把數(shù)據(jù)分布式存儲,計算網(wǎng)格就是將任務分解為子認為并行計算。

          一個計算網(wǎng)格平臺的作用就是將任務分解開來,交給不同的結點機器運行,然后把運行結果匯聚起來。這就是Split and Aggregate。如下圖所示,一個job請求分解為三個sub-job,分別被不同的機器執(zhí)行,然后把結果匯聚,返回給調用的客戶。

           

          GridGain是一個開源的java網(wǎng)格平臺。它集成了很多現(xiàn)成的框架,例如

          JBoss
          Spring
          Spring AOP
          JBoss AOP
          AspectJ
          JGroups

          GridGain有兩個方法將應用程序grid化:

          第一種是使用AOP

          假設有一個應用

          01 class BizLogic {
          02   public static Result process(String param) {
          03     
          04   }
          05 }
          06 
          07 class Caller {
          08   public static void Main(String[] args) {
          09     BizLogic.process(args[0]);
          10   }
          11 }

          如果要把process grid化,只要簡單的使用一個@Gridify的annotation即可,在Caller客戶端要啟動GridFactory

          01 class BizLogic {
          02   @Gridify()Here
          03   public static Result process(String param) {
          04     
          05   }
          06 }
          07 
          08 class Caller {
          09   public static void Main(String[] args) {
          10     GridFactory.start();Here
          11 
          12     try {
          13       BizLogic.process(args[0]);
          14     }
          15     finally {
          16       GridFactory.stop();Here
          17     }
          18   }
          19 }

          posted on 2011-08-06 14:59 w@ns0ng 閱讀(349) 評論(0)  編輯  收藏 所屬分類: GridGain

          主站蜘蛛池模板: 西城区| 梁河县| 宝鸡市| 淮滨县| 汝南县| 临洮县| 安化县| 泽州县| 雷山县| 乌兰县| 定襄县| 肇东市| 天长市| 宝应县| 福鼎市| 县级市| 花莲县| 尉犁县| 陇川县| 沙坪坝区| 富宁县| 资阳市| 平湖市| 托克逊县| 阿坝县| 永顺县| 宜丰县| 宜川县| 汤原县| 会泽县| 绥滨县| 邻水| 体育| 黑河市| 四会市| 白玉县| 杂多县| 格尔木市| 维西| 英吉沙县| 紫云|