Concept and mechanism
Start diagnosis with the time window, version, environment, and affected request set. Structured logs correlate failures; metrics show volume and trends; representative request traces break down time across dependencies. No single signal proves the whole cause. An error rate needs numerator and denominator with the same scope: 30 Errors across 1500 Invocations gives 2%, while Throttles requires separate interpretation. Avoid unique request identifiers as dimensions on every metric because each combination creates another series. Keep that detail in suitable logs or traces without credentials and with controlled access.
Guided application
Concurrency measures in-flight work, not merely arrival rate. If each invocation uses one connection and the workload has 20, allowing 80 can saturate the database. A limit protects the dependency but may increase backlog and latency; monitor the service deadline. Lambda memory also influences CPU, so a larger configuration may finish faster. In a rehearsal, 0.5 GB for 0.8 seconds uses 0.4 GB-s; 1 GB for 0.3 seconds uses 0.3 GB-s. This limited comparison is not a total bill. Measure representative load, variability, and other costs before choosing. Change one hypothesis at a time when improvement attribution matters.
Before adding workers to reduce queue age, check per-message duration and database capacity. If waiting comes from exhausted connections, more workers can worsen total time.
Common pitfalls
Averages treated as proof about every request; unbounded dimensions; minimum memory treated as minimum cost; reserved concurrency treated as prewarming.
Related topics: Events, retries, and idempotency · Data, concurrency, and pagination
Optimization requires measuring application and dependency effects, including operational cost.
Reference: Lambda metric types · DVA-C02; exam guide 2.1