You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many solutions in the cloud involve running tasks that invoke services. In this environment, if a service is subjected to intermittent heavy loads, it can cause performance or reliability issues. If the same service is utilized by a number of tasks running concurrently, it can be difficult to predict the volume of requests to which the service might be subjected at any given point in time. It is possible that a service might experience peaks in demand that cause it to become overloaded and unable to respond to requests in a timely manner.
@@ -21,27 +21,27 @@ The queue effectively decouples the tasks from the service, and the service can
21
21
## Benefits
22
22
* It can help to maximize availability because delays arising in services will not have an immediate and direct impact on the application, which can continue to post messages to the queue even when the service is not available or is not currently processing messages.
23
23
* It can help to maximize scalability because both the number of queues and the number of services can be varied to meet demand.
24
-
* It can help to control costs because the number of service instances deployed needs only to be sufficient to meet average
24
+
* It can help to control costs because the number of service instances deployed needs only to be sufficient to meet average
25
25
load rather than the peak load.
26
26
27
27
## Implementation
28
28
* We will demonstrate Queue-Based Load Leveling Pattern by developing a simple application.
29
29
* Following are the core classes in the application,
30
30
- TaskGenerator: This is the service requester class where we create any number of requests and submit them to the Task Queue. Each TaskGenerator instance is a Thread. Each requester submits requests at its own rate.
- MessageQueue: In this class we have a BlockingQueue which takes messages submitted from the TaskGenerators. This class is just used for storing and retreiving tasks from the Queue.
- ServiceExecutor: Picks up the tasks from the MessageQueue and serves them. The ServiceRequester picks up requests at constant rate even though the TaksGenerators submitted at a different rate.
0 commit comments