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
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