What am I charged for?
You are charged whenever a container is running. This includes:- Running any code you’ve defined in an
on_startfunction - Running your application code
- Any
keep_warm_secondsyou’ve set
What am I not charged for?
- Waiting for a machine to start
- Pulling your container image
Default Container Spin-down Times
After handling a request, Beam keeps containers running (“warm”) for a certain amount of time in order to quickly handle future requests. By default, these are the container “keep warm” times for each deployment type:| Deployment Type | Container Keep Warm Duration |
|---|---|
| Endpoints/ASGI/Realtime | 180s |
| Task Queues | 10s |
| Pods | 600s |
Real-World Example
You’ve deployed a REST API. You’ve added two Python Packages in yourImage(), which are loaded when your app first starts.
You’ve also added a keep_warm_seconds=300, which will keep the container alive for 300 seconds (5 minutes) after each request.
app.py
- 1s to boot your application and run your
on_startfunction. - 100ms to run your task.
- 300s to keep the container alive, based on the
keep_warm_secondsargument.