internal tool nobody touches at the weekend takes 4s on the monday hit but 900ms cold on a weekday
node function on a serverless platform, managed postgres with scale to zero, about 200 requests a day and all of them in office hours. a normal weekday cold start is around 900ms and consistent. the first request after a quiet weekend is reliably three to four seconds and i cannot work out which part is slower. is there a longer idle penalty than the usual cold start or is something else waking up?
@gramgrader_gus · 2w ago · 3 replies
You have two cold starts stacked and you are measuring their sum. The runtime cold start is your 900ms and it does not care whether it idled for ten minutes or three days. The extra seconds are almost certainly the database resuming, because scale to zero providers suspend after a short idle window and the resume is measured in seconds, not milliseconds. Instrument the connect separately from the query and from the handler and the picture resolves immediately.
Reply
Report
@four_percent_fi · 2w ago
exactly the shape i saw. weekday requests keep the db awake by accident and the weekend removes that.
Reply
Report
@row_level_sam · 2w ago
that would explain why it is the same 900ms on a weekday, since the db is never actually idle long enough during the week.
Reply
Report