A records-office function usually finishes in under 20 seconds, but the team set timeout to 300 seconds “just in case.” What is the recommended timeout practice?
Select an answer to reveal the explanation.
Short Explanation
Give the meeting room almost as long as the agenda—not all day, and not two minutes for an hour’s work. A timeout near expected duration frees hung invokes sooner without chopping off healthy runs.
Full Explanation
Timeout should track expected duration for the records-office function. If healthy work finishes in under 20 seconds, a timeout near that expectation (with modest headroom) fails hung invokes promptly and releases allocated capacity. Setting 300 seconds “just in case” keeps failing or stuck invokes reserved far longer than needed, delaying failure detection and wasting concurrency under load.
Always using the maximum timeout so hung invokes never fail is the opposite of good operations—failures should surface, and capacity should recycle. Setting timeout to 1 second to force rapid retries regardless of workload cuts off legitimate work and amplifies retry storms. Claiming timeout is irrelevant unless detached invoke is used is incorrect; timeout bounds synchronous (and related) invoke execution regardless of that misconception.
Exam caveat: timeout interacts with upstream API Gateway or client timeouts—mismatched layers produce confusing 504s even when the function setting looks “safe.” Operational check: baseline p95/p99 duration for typical records payloads, set function timeout slightly above that baseline, align gateway/client timeouts, inject a deliberate hang in a non-prod test to confirm timely failure, and avoid maxing timeout without a measured need.