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ù)分解為子認為并行計算。

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

           

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

          JBoss
          Spring
          Spring AOP
          JBoss AOP
          AspectJ
          JGroups

          GridGain有兩個方法將應(yīng)用程序grid化:

          第一種是使用AOP

          假設(shè)有一個應(yīng)用

          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

          主站蜘蛛池模板: 宜昌市| 敖汉旗| 荆州市| 海门市| 贵南县| 民丰县| 莱西市| 凤凰县| 黄龙县| 班玛县| 崇信县| 江源县| 通榆县| 辉县市| 怀集县| 余江县| 婺源县| 呼和浩特市| 陆良县| 东平县| 祁门县| 普兰店市| 富阳市| 蒙城县| 报价| 虞城县| 大田县| 班戈县| 珲春市| 浦北县| 台北市| 金堂县| 长子县| 铜梁县| 宜川县| 改则县| 沙湾县| 凤庆县| 天镇县| 渭源县| 临西县|