java - 集群环境下多机器间进行同步操作有什么可选的解决方案?(最好用伪代码写出关键部分)
怪我咯
怪我咯 2017-04-18 09:31:27
0
3
317

集群环境下多机器间进行同步操作有什么可选的解决方案?(最好用伪代码写出关键部分)

补充说明问题:比如有一个创建订单的API,同时到达集群中的多台机器上。如何保证只能有效的生成一条订单数据。

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(3)
左手右手慢动作

Don’t limit your thinking to the cluster system. Think about what problems the cluster was mainly designed to deal with at that time?

Assuming that your order generation and order data operations do not have such a heavy load, why not peel off an order service, and then all front-ends in the cluster call this service to generate orders, thus simplifying the entire process, etc. When the service load reaches an order of magnitude, optimize the service separately, such as adding a queue, first letting the data enter the queue, and then the front-end waits for polling to detect whether the order is generated, and then prompts that the order is generated successfully

I only provide one idea. I don’t know how to give you this pseudo code. I feel that following this idea, it is already clearer

洪涛

Does this require a distribution process? There is a front-end server in front of it, which is dedicated to forwarding requests and independently distributing them to different servers

巴扎黑

Of course it is a message queue to ensure that only one server handles it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template