# Concurrency

Concurrency is the ability of a system to keep multiple tasks in progress during overlapping periods of time.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/concurrency

> Concurrent tasks can execute simultaneously or take turns using shared resources while other tasks wait for input, output, or dependencies. In cloud applications, understanding concurrency helps engineers size capacity, improve throughput, protect downstream systems, and diagnose throttling or resource contention.

Practice exams covering Concurrency: [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Concurrency

Effective concurrency management balances overlapping work against resource capacity, downstream limits, and correctness requirements.

1. **Overlapping work, not necessarily parallel work**: Tasks are concurrent when their lifetimes overlap, even when one processor interleaves their execution. Distinguish this from parallel execution when selecting asynchronous programming, additional cores, or additional instances.
2. **Relationship between rate and duration**: For a stable workload, estimate average concurrency by multiplying arrival rate by average time in the measured system. Use consistent boundaries and units, and allow headroom for bursts and long-running requests.
3. **Bounded resource consumption**: Limit active work to protect memory, CPU, database connections, and external APIs. A higher concurrency limit can reduce performance when it creates resource contention.
4. **Buffering and backpressure**: Queues absorb temporary bursts, while backpressure slows or rejects producers when capacity is exhausted. Monitor queue age and backlog because sustained excess demand cannot be solved by buffering alone.
5. **Safe shared-state updates**: Concurrent operations can race when they read and modify shared data. Use transactions, conditional updates, and idempotent processing to preserve correctness under overlapping execution and retries.
6. **Measurement-driven tuning**: Observe concurrency alongside latency, throughput, throttling, and dependency utilization. Load-test changes to worker counts or execution limits to determine whether the bottleneck improves or simply moves downstream.

## Cloud services for Concurrency

SQS can buffer incoming jobs while Lambda functions or ECS workers process them at a controlled level of concurrency. Set processing limits according to measured execution duration and the capacity of shared dependencies, rather than queue depth alone. CloudWatch metrics and alarms reveal whether active work, processing time, throttling, or backlog is increasing. Together, these services support a design that absorbs temporary bursts, scales processing where appropriate, and avoids overwhelming downstream systems. Application-level idempotency and safe data updates remain necessary even when infrastructure controls limit concurrent work.

- **[AWS Lambda](https://blowstack.com/tools/cloud-services-hub/aws-lambda)**: Lambda processes overlapping invocations using execution environments subject to concurrency quotas and function-level settings. Reserved concurrency allocates and caps function concurrency, while provisioned concurrency prepares initialized environments to reduce startup latency.
- **[Amazon CloudWatch](https://blowstack.com/tools/cloud-services-hub/amazon-cloudwatch)**: CloudWatch provides metrics and alarms for diagnosing concurrency-related behavior, including Lambda concurrent executions and throttles, SQS backlog and message age, and ECS resource utilization. Correlating these signals with processing duration helps distinguish insufficient capacity from slow dependencies.

## Concurrency exam questions

Real practice exam questions on Concurrency, with the correct answer and its explanation.

### Question 1 (DVA-C02)

**Question:**

A document-indexing application uses a single worker process to consume messages from an Amazon SQS standard queue. The worker continuously receives messages and starts an asynchronous indexing request for each message without waiting for earlier requests to finish. It deletes messages only after successful indexing, extends visibility while processing, and retries throttled requests with exponential backoff and jitter.

During temporary slowdowns, the indexing endpoint returns HTTP 429 responses. The worker's pending requests and memory usage continue to grow even though retries are delayed. Messages can remain in the queue during these slowdowns, and the queue's retention period is sufficient.

Which change should a developer make to keep the worker's resource usage bounded and make its consumption respond to downstream capacity?

**Correct answer:** Use a bounded pool of in-flight indexing operations. Receive messages only when slots are available, fetch no more messages than available slots, and reduce the pool's concurrency when the endpoint throttles requests.

**Explanation:** The bounded pool limits outstanding work, and pausing receives when the pool is full leaves excess work durably buffered in SQS. Reducing concurrency in response to throttling propagates downstream capacity constraints to message consumption. Existing visibility extension, retry, and deletion behavior preserves unfinished work.

### Question 2 (SAP-C03)

**Question:**

A document-processing platform uses two Amazon SQS standard queues: an interactive queue and a bulk-import queue. Separate event source mappings invoke the same AWS Lambda function. Each invocation processes one message and makes one request at a time to a shared downstream service.

The downstream service supports at most 100 simultaneous requests from this function. Interactive processing must be able to scale to 80 concurrent invocations, and bulk processing must be able to scale to 20 concurrent invocations, including when both queues have sustained backlogs. Neither queue may exceed its respective concurrency limit. Other Lambda functions run in the same account, but sufficient Regional concurrency is available.

The company must retain the single function, avoid application-managed concurrency controls, and incur no provisioned-concurrency charges while the queues are idle.

Which configuration meets these requirements?

**Correct answer:** Set the function's reserved concurrency to 100. Set maximum concurrency to 80 on the interactive queue's event source mapping and to 20 on the bulk queue's event source mapping.

**Explanation:** Event source mapping maximum concurrency independently limits concurrent invocations from each SQS queue. The limits of 80 and 20 protect both workload allocations and keep total downstream concurrency at or below 100. Reserved concurrency of 100 reserves sufficient function capacity for both mappings and imposes a function-wide ceiling. Reserved concurrency does not incur provisioned-concurrency charges.

## Practice Concurrency in a full exam

Questions on Concurrency in each practice exam, with every answer option and an explanation for each:

- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 5 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 2 questions

## What is Concurrency

Concurrency describes overlapping work: multiple requests, jobs, or operations are in progress before all of them have finished. A web application might handle another request while an earlier request waits for a database response. Both requests are concurrent even if a single processor alternates between them. Parallelism is different: it means work actually executes at the same instant, usually on multiple processor cores or machines. A system can therefore be concurrent without executing tasks in parallel.

Concurrency is also different from request rate and throughput. Request rate describes arrivals per unit of time; throughput describes completions per unit of time. Concurrency describes how much work is in progress. For a stable system, average in-progress work is approximately arrival rate multiplied by average time spent within the measured boundary. For example, 100 requests per second with an average processing duration of 0.2 seconds require about 20 concurrent processing slots. If processing duration rises to one second at the same rate, the average requirement rises to 100. These averages support capacity estimates, but bursts and variable durations require additional headroom.

Cloud applications implement concurrency through asynchronous operations, thread pools, worker processes, containers, and multiple service instances. An asynchronous server can keep many requests in progress while waiting for network responses without assigning a dedicated thread to every request. However, asynchronous execution does not eliminate CPU, memory, connection, or downstream capacity limits. Increasing the number of workers helps only while the resources they depend on can support the additional work.

A practical concurrency limit controls how many operations may be active at once. Suppose an order-processing application uses a database connection pool with 40 connections. Allowing hundreds of workers to issue database operations simultaneously may increase waiting, timeouts, and retries rather than throughput. A bounded worker pool and a queue can absorb a temporary burst while keeping database demand within a safe range. Persistent arrivals above processing capacity will still create an increasing backlog, so buffering is not a substitute for sufficient capacity.

AWS Lambda provides an exam-relevant example: concurrency measures function invocations being processed at the same time. Reserved concurrency sets aside part of the account's Regional concurrency allocation for a function and also caps that function's concurrency; it does not preinitialize execution environments. Provisioned concurrency maintains initialized environments to reduce startup latency, but it is not itself a maximum concurrency setting. Requests beyond provisioned capacity can use additional available concurrency unless another limit prevents them. Throttling behavior and retry handling depend on the invocation source.

Concurrency also introduces correctness risks. Two workers updating the same inventory record can overwrite each other's changes unless the application uses appropriate transactions, conditional writes, or other coordination. Retries can repeat side effects, so operations such as payment submission should use idempotency controls. During troubleshooting, correlate active work with duration, throughput, queue age, throttles, resource utilization, and downstream errors. Tune concurrency using load tests and measured bottlenecks rather than assuming that more simultaneous work always makes an application faster.

## Learn Concurrency in lessons

1 short lesson on Concurrency in 1 certification course.

- SAP-C03: Concurrency: capacity limits under burst traffic (Premium), https://app.blowstack.com/lessons/concurrency-capacity-limits-under-burst-traffic-sap-c03
