使用EJB将多个服务器上的进程并行化 [英] Parallelize a process on several servers with EJB

查看:154
本文介绍了使用EJB将多个服务器上的进程并行化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Glassfish 3.1和JEE6。我想做的是在几个服务器上并行化长CPU进程。
例如,我有1000个图像和10个服务器,我希望每个服务器处理100个图像并将结果返回到主。



我的第一个想法是在每个请求中,我从每个服务器调用远程EJB(异步),将图像作为参数处理,并等待结果。是否可以调用不同的机器相同的远程EJB?
这个方法的问题是我必须手动设置所有服务器的列表。如果我想删除或添加一个,我必须再次部署应用程序。我想使用一种更具动态性的方法。



使用JMS可能是一个更好的主意?如果是这样,怎么办?主人创建一个队列,每个工作机器都可以访问这个队列。主人不需要知道每个工作机器的ip。问题是,主人不会知道有多少工作人员,以及他要分割图像数量的程序...



其他的想法是使用Hadoop ,但我几乎不了解它...



我想从你那里得到一些建议,在JEE6应用程序中最好的方法是什么? / p>

解决方案

如果我理解正确,您的架构将工作推送给每个工作人员。通常最好将工作添加到队列中,并且每次完成任务时都将员工从队列中拉出。



也许考虑到Celery - http://www.celeryproject .org / (由于您使用Jelastic,您可能希望知道这可以安装在Jelastic VDS上)


I'm using Glassfish 3.1 and JEE6. What I would like to do is so parallelize a long CPU process on several servers. If by example, I have 1000 images and 10 servers, I would like each server processes 100 images and return the results to the "master".

My first thought is at each request, I call the remote EJB (asynchronous) from each servers with the images to process as parameter and wait the result. Is it possible to call for different machines the same remote EJB? Problem with this method is I have to set manually the list of all servers. If I want to remove or add one, I have to deployed again the application. I would like to use a method more dynamic.

Using JMS could be a better idea? If so, how to do it? The master creates a queue, and each "worker" machine, can access to this queue. The master doesn't need to know the ip of each "worker" machine. Problem is, the master will not know how many workers there are and in how many parts he has to split the images to process...

Other idea is to use Hadoop, but I mostly know nothing about it...

I would like to have some advice from you, what is the best way to do it in a JEE6 application?

解决方案

If I understood correctly, your schema pushes work to each of the workers. It's generally better to add work to a queue, and have the workers pull from the queue each time they finish a task.

Maybe consider Celery for it - http://www.celeryproject.org/ (Since you're using Jelastic, you might like to know that this can be installed on a Jelastic VDS)

这篇关于使用EJB将多个服务器上的进程并行化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆