Ravindra BagaleCourses & study guides मराठी

Chapter 93: AWS Lambda and Serverless for DevOps

DevOps

93.7 Timeout, memory, concurrency and cost guardrails

Story (fictional teaching scenario). In a fictional Indore warehouse, Fatima from Cairo notices a retry storm overwhelming a small database. Raising Lambda memory alone will not protect the database.

Timeout, memory, concurrency and cost guardrails
Timeout, memory, concurrency and cost guardrails

Why

A fast-scaling function can exceed a downstream system’s capacity and your budget.

What

  • Timeout stops an invocation after its configured duration. Ordinary Lambda event functions have a maximum of 900 seconds (15 minutes).
  • Memory is configured from 128 to 10240 MB for this mode; CPU power increases with memory.
  • Concurrency is the number of invocations executing at once.
  • Reserved concurrency both reserves capacity and caps a function's concurrency; zero stops processing for that function.
  • Provisioned concurrency pre-initializes environments to reduce startup latency and has additional charges. It is not the same as reserved concurrency.
  • Quota is a service limit. Published regional account default is 1000 concurrent executions, but new accounts may have lower limits.

How

  1. Choose a timeout from measurements and downstream deadlines.

  2. Load-test memory choices in a future funded lab, never assume smaller is cheapest.

  3. Cap concurrency to match database capacity.

  4. Set budget alerts; an alert is not an automatic hard spending cap.

Example 1: Capacity estimate, not a load test

  1. Read the input and the code.
Arrival rate: 20 requests/second
Average duration: 0.5 second
Approximate concurrency = rate * duration
  1. Read the result.

Output (illustrative; not executed on AWS)

20 * 0.5 = 10 concurrent invocations on average
  1. What each part means: The estimate helps plan, but bursts, cold starts and retries can need more. A cap of ten may throttle during bursts. A throttle is a refusal/delay due to exhausted capacity; retry behaviour depends on the event path.

Example 2: Cost units without inventing a price

  1. Read the input and the code.
Configured memory: 512 MB (0.5 GB)
Billed duration example: 0.2 seconds
Compute usage per invocation = 0.5 * 0.2
  1. Read the result.

Output (illustrative; not executed on AWS)

0.1 GB-seconds, plus request and any other applicable charges
  1. What each part means: GB-seconds combine memory and billed time. Multiply by current regional/architecture rates for an approximate estimate. Requests, provisioned concurrency, logs, API Gateway, networking and storage may add costs. No dollar or rupee quote is claimed here.

Ravindra Bagale's Tip

Reserved limits parallel work; provisioned keeps environments ready.

Did you understand? Let us try it once more.