Load Levelling Pattern

Learn the Load Levelling design pattern and its usage.

Intent

This pattern allows the handling of peak loads and slow-running tasks by introducing temporal decoupling between consumers and producers using message queues.The Load Leveling pattern is also known as the Decoupled Invocation pattern.

Context and problem

Depending on the nature of an application, the Request Load pattern will vary. Unless the application is a batch-based system where the processing flows are triggered at regular intervals with a predictable load, the load on the application will not be evenly distributed. Whether the traffic pattern is publicity-driven, market-driven, or seasonal, there are certain periods, such as early-evening hours, weekends, ends of the quarters, or the holiday season, where the load on the system will reach its peak. One way to cope with this instant load burst and the spike in resource utilization is to add more hardware to cover the peak loads. This is not a cost-effective approach as the resources are not utilized during the rest of the time when the load is not at its peak.

Forces and solution

Load leveling with queues is a better approach to cope with such unpredictable peak loads. With this approach, a queue is introduced to store requests and decouple the execution from the request submission.

Get hands-on with 1400+ tech skills courses.