开源云平台GridGain
GridGain 是从网格计算进入到云计算平台,是一种云计算框架,可以让Java开发者编写自己本地的云计算应用。
GridGain 是基于Java 5并行计算模型,使用起来很方便:
Grid grid = GridFactory.getGrid();
// Get cloud-wide thread pool instance.
ExecutorService pool = grid.newGridServiceExecutor();
// Run callable or runnables on the cloud...
pool.submit(new Callable() {
// Task that will be executed on some thread
// somewhere on the cloud (and you can control
// precisely where and how...)
public void call() {
...
}
});
这样你获得一个自动负载平衡的线程池,而如果你采取传统tomcat实现,虽然你可能没有注意需要获得线程池,JavaEE的Servlet/Jsp技术规范封装了线程池,但是这种线程池是不可伸缩的,正如数据库一样,是有天花板的。参见:http://www.jdon.com/jivejdon/thread/36622.html
使用GridGain 云计算开发你的云应用也很简单,类似于使用JDK5的Future.get和Callable,相关帖子:
http://www.jdon.com/jivejdon/forum/messageList.shtml?thread=35060&message=23118601#23118601
比如,将你的GridHelloWorld应用使用GridGain 云平台,客户端代码如下:
//获得一个GridGain 实例
Grid grid = (Grid)ctx.getBean("mySpringBean");
//获得类似JDK并发模型中的ExecutorService
ExecutorService exec = grid.newGridExecutorService();
//提交给GridGain云平台计算
Future<String> res = exec.submit(new GridHelloWorldCallable());
//等待计算完成 Wait for callable completion.
res.get();
http://www.gridgain.com/
[该贴被banq于2009-07-24 10:23修改过]