C++:客户端-服务器分布式处理思想,发送数据后关闭连接,任务完成后重新打开?
因此,我正在尝试考虑建立分布式计算客户端-服务器架构的最佳方法,该架构允许最多可能的客户端,而又不会对服务器造成太大负担。
*注意,我正在使用 boost 库,尽管我还没有启动任何客户端/服务器代码。
我想我想打开一个从客户端到服务器的 TCP 连接,说“嘿,我会为你做一些工作”,他们服务器在该连接期间发送一个任务和该任务的数据,然后关闭该连接,以便服务器没有大量打开的套接字线程。当客户端完成处理后,它会重新连接到服务器并发送完成的数据(如果没有进一步的任务需要完成,则再次关闭连接)。
这是个好主意吗?这样做的最佳方法是什么?
服务器可能需要管理多达 256 个客户端(最大情况)。
So, I'm trying to think of the best way to have a distributed computing client-server architecture that allows for the most possible clients without being too hard on the server.
*Note, I'm using the boost library, though I haven't started any client / server code yet.
I think I want to open a TCP connection from a client to the server, saying "hey I'll do some work for ya", they server sends a task and data for that task during that connection, then closes that connection so that the server doesn't have a ton of open socket threads. When the client finishes processing, it would re-connect to the server and send the completed data (closing the connection again if there are no further tasks to be done).
Is this a good idea? What is the best way to go about doing this?
It's possible that the server would need to manage up to 256 clients (biggest case).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您看过亚马逊的 MapReduce 服务吗?它正是为此类事情而构建的。
http://aws.amazon.com/elasticmapreduce/
它具有大规模可扩展性,并且可以处理大约任何你可以投入的工作。
编辑:如果您想要一个开放的解决方案,我建议您查看 Apache Hadoop 及其 MapReduce 产品。此外,如果这对您的应用程序有利,您还可以查看 OpenStack 来托管您自己的云基础设施。
http://www.openstack.org/
Have you looked at Amazon's MapReduce service? It is built for exactly this sort of thing.
http://aws.amazon.com/elasticmapreduce/
It is massively scalable, and will handle just about any job you can throw at it.
EDIT: If you want an open solution, I suggest looking at Apache Hadoop and its MapReduce offering. Also, you can check out OpenStack to host your own cloud infrastructure, if that seems advantageous for your application.
http://www.openstack.org/
我建议您可以选择探索 BOINC 软件,它是开源的,而且正是考虑到这一点而设计。这假设该任务不需要与其他客户端通信,只需与服务器通信。
这是 seti@home、einstein@home、folding@home 和几乎所有 @home 所使用的软件!
I would suggest as an option to explore the BOINC software which is open-source and is precisely designed with this in mind. This assumes that the task will not need to communicate to other clients, just with the server
This is the software used by seti@home, einstein@home, folding@home and almost anything @home!