79541844

Date: 2025-03-28 15:45:49
Score: 1
Natty:
Report link

will I be billed for CPU time while waiting on that external API

Yes.

The CPU is not actively being used, so it would make sense if I was not billed

You are billed for as long as a function is in the middle of invocation, from the time it starts to the time it returns a response. The busy-ness of the CPU is never the issue - what matters is that the CPU is allocated and available to perform work during an invocation. The only time you are not billed for CPU on a given server instance is if there are no active requests for that instance (eventually allowing it to scale down).

Gen 2 functions improve on this by allowing multiple concurrent requests, so that they all share the same total billing time. You will want to read this documentation to better understand how it works. Specifically:

When setting concurrency higher than one request at a time, multiple requests can share the allocated CPU and memory of an instance.

See also:

Reasons:
  • Blacklisted phrase (1): this document
  • Long answer (-0.5):
  • No code block (0.5):
  • Ends in question mark (2):
  • High reputation (-2):
Posted by: Doug Stevenson