Working Within Lambda Limits and Controlling Concurrency
This lesson explains Lambda's limits, which decide which data jobs it can run at all, and its concurrency settings, which decide how hard it drives the systems behind it.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the Lambda limits that affect data processing.
- Calculate concurrency from request rate and duration.
- Use reserved and provisioned concurrency.
- Protect downstream systems from Lambda scaling.
Key limits
Lambda's limits decide which data tasks it can do. Memory ranges from 128 MB to 10 GB, and CPU power grows in proportion, so a slow, CPU-bound function often runs faster, and sometimes cheaper, with more memory. A function can run for at most 15 minutes, so longer processing belongs in Glue, EMR, ECS or a Step Functions workflow that splits the work. Payloads are limited to 6 MB for synchronous calls and 1 MB for asynchronous calls, so large data is passed as a reference to an S3 object, not in the event. The following table summarises the limits.
| Setting | Range |
|---|---|
| Memory | 128 MB to 10 GB; CPU scales with memory |
| Timeout | At most 15 minutes (longer jobs belong in Glue, EMR, ECS or Step Functions) |
| Synchronous payload | 6 MB request and response |
| Asynchronous payload | 1 MB |
15min
Maximum function run time
10GB
Maximum memory
6MB
Synchronous payload
1MB
Asynchronous payload
Within Lambda's limits?
How Lambda scales
Each execution environment handles one request at a time, so concurrency equals requests per second multiplied by average duration. Each function scales by up to 1,000 additional environments every ten seconds, within the account's Regional concurrency quota (1,000 by default, which can be raised). For stream sources, concurrency follows the number of shards multiplied by the parallelisation factor.
Concurrency arithmetic
Concurrency controls
Concurrency is the number of function instances running at once, and three settings control it. Reserved concurrency sets aside capacity for a function and also caps it at that number. The cap is often the main point in pipelines: it stops a burst of events from opening thousands of connections to a database that cannot handle them. Provisioned concurrency keeps a number of execution environments initialised and ready, which removes the start-up delay, the cold start, for latency-sensitive functions.
Maximum concurrency on an SQS event source limits how many functions one queue invokes at the same time, so several queues can share a function without one consuming all of its capacity. The following table summarises the controls.
| Setting | Effect |
|---|---|
| Reserved concurrency | Guarantees capacity and caps it, protecting downstream systems such as a database |
| Provisioned concurrency | Keeps environments initialised, removing cold starts |
| Maximum concurrency on an SQS event source | Limits how many functions a queue invokes at once |
Concurrency controls
Protecting downstream systems
Lambda can scale much faster than the databases and APIs it calls: a burst of events can start hundreds of concurrent invocations, each opening a database connection or calling an API with a rate limit. Several protections prevent this from overwhelming downstream systems.
Reserved concurrency caps how many copies of a function can run at once, and for SQS event sources, maximum concurrency caps how many concurrent invocations the queue triggers. RDS Proxy pools database connections, so many invocations share a small number of connections. An Amazon SQS queue placed in front of the function turns bursts into a steady flow that downstream systems can handle.
The following diagram compares an unprotected function with a protected one.

Is Lambda the right tool?
Lambda is well suited to some data processing jobs but not to others. The following table assesses several jobs against Lambda's limits and gives the reason in each case.
| Job | Fits Lambda? | Reason |
|---|---|---|
| Validate and route each uploaded file (under 1 minute each) | Yes | Short, event-driven, scales with uploads |
| Transform a 30 GB file | No | 15-minute limit and 10 GB memory; use Glue or EMR |
| Process records from a Kinesis stream | Yes | Event source mapping handles batching |
| Join two large tables every night | No | A distributed engine (Glue, EMR, Redshift) suits it |
When a Lambda-based pipeline writes to a database, reserved concurrency or the SQS event source's maximum concurrency stops thousands of parallel functions overwhelming it.
How can a database be protected from Lambda's fast scaling?
Show answer
With reserved concurrency, which caps the function's concurrent executions, and RDS Proxy, which pools connections.
Exam Tips
Remember for the exam
- Jobs longer than 15 minutes belong in Glue, EMR, ECS or Step Functions.
- To give a CPU-bound function more CPU, increase its memory.
- To protect a database from Lambda's scaling, use reserved concurrency and RDS Proxy.
- To remove cold starts, use provisioned concurrency.
- To limit how fast a queue drives a function, set maximum concurrency on the SQS event source.