2016-11-20 16:25:10 +05:30
---
layout: pattern
title: Queue based load leveling
folder: queue-load-leveling
permalink: /patterns/queue-load-leveling/
2019-12-13 21:09:28 +02:00
categories: Concurrency
2021-05-19 10:49:05 -06:00
language: en
2016-11-20 16:25:10 +05:30
tags:
2019-12-13 21:09:28 +02:00
- Decoupling
2016-11-20 16:25:10 +05:30
- Performance
2020-07-26 11:30:42 +03:00
- Cloud distributed
2016-11-20 16:25:10 +05:30
---
## Intent
Use a queue that acts as a buffer between a task and a service that it invokes in order to smooth
intermittent heavy loads that may otherwise cause the service to fail or the task to time out.
This pattern can help to minimize the impact of peaks in demand on availability and responsiveness
for both the task and the service.
2019-12-07 20:01:13 +02:00
## Class diagram
2016-11-20 16:25:10 +05:30

## Applicability
* This pattern is ideally suited to any type of application that uses services that may be subject to overloading.
* This pattern might not be suitable if the application expects a response from the service with minimal latency.
2017-01-21 12:56:42 +02:00
## Tutorials
* [Queue-Based Load Leveling Pattern ](http://java-design-patterns.com/blog/queue-load-leveling/ )
2016-11-20 16:25:10 +05:30
## Real world example
* A Microsoft Azure web role stores data by using a separate storage service. If a large number of instances of the web role run concurrently, it is possible that the storage service could be overwhelmed and be unable to respond to requests quickly enough to prevent these requests from timing out or failing.
## Credits
2020-07-26 11:30:42 +03:00
* [Queue-Based Load Leveling pattern ](https://docs.microsoft.com/en-us/azure/architecture/patterns/queue-based-load-leveling )