Profiling a receipt-generation Lambda shows JSON serialization dominating CPU on the hot path. What should the municipal developer do first?
Select an answer to reveal the explanation.
Short Explanation
When the profiler points at JSON packing as the furnace, don't rebuild the whole house. Fix that hot serialization path first. Guessing that auth is the villain wastes a sprint.
Full Explanation
Profiling a receipt-generation Lambda that shows JSON serialization dominating CPU on the hot path means the municipal developer should optimize or replace that hot serialization path before rewriting unrelated modules. Performance work follows evidence: fix the dominant consumer of CPU first. Touching authentication libraries first because "auth always dominates" ignores the profile.
Rewriting the authentication library first without profile evidence wastes effort when serialization dominates.
Increasing only CloudWatch Logs retention does not fix CPU time spent serializing receipts.
Disabling all metrics so profiling noise disappears removes the data needed to verify improvement.
Exam caveat: Use profiling evidence to prioritize optimizations; do not optimize by folklore.
Operational check: Capture a profile under realistic receipt load, optimize JSON serialization (library choice, fewer fields, reuse buffers), re-profile, and confirm p95 CPU and duration improve before wider rollout. Keep the civic/municipal context in mind: month-end receipt bursts make hot-path serialization costs highly visible on city billing functions. Document the finding in the municipal incident ticket so the next on-call engineer inherits evidence rather than folklore.