It provides a load-leveled system that can handle wide variations in the volume of requests sent by application instances. This solution has the following benefits: The figure illustrates using a message queue to distribute work to instances of a service. This approach enables the same pool of consumer service instances to handle messages from any instance of the application. The application posts requests in the form of messages to the queue, and the consumer service instances receive messages from the queue and process them. Use a message queue to implement the communication channel between the application and the instances of the consumer service. The workload also needs to be load balanced across consumers to prevent an instance from becoming a bottleneck. However, these consumers must be coordinated to ensure that each message is only delivered to a single consumer. To handle this fluctuating workload, the system can run multiple instances of the consumer service. Or, the messaging system might be overloaded by an influx of messages that come from the application. By using a single instance of the consumer service, you can cause that instance to become flooded with requests. Additionally, the nature of the work performed to handle these requests might be highly variable. At peak hours, a system might need to process many hundreds of requests per second, while at other times the number could be very small. A sudden increase in user activity or aggregated requests coming from multiple tenants can cause an unpredictable workload. The number of requests can vary significantly over time for many reasons. This strategy helps to ensure that the business logic in the application isn't blocked, while the requests are being processed.
Rather than process each request synchronously, a common technique is for the application to pass them through a messaging system to another service (a consumer service) that handles them asynchronously. Context and problemĪn application running in the cloud is expected to handle a large number of requests. With multiple concurrent consumers, a system can process multiple messages concurrently to optimize throughput, to improve scalability and availability, and to balance the workload. Enable multiple concurrent consumers to process messages received on the same messaging channel.