Skip to main content
Workers are containerized environments that run your code on Runpod Serverless.

Deployment workflow

After creating your handler function, package it into a Docker image and deploy it to an endpoint:
1

Create a Dockerfile

Package your handler function and all its dependencies into a Docker image.
2

Deploy to an endpoint

Push your image and create an endpoint using one of two methods:

Model deployment

To deploy workers with AI/ML models, follow this order of preference:
  1. Use cached models: For models on Hugging Face (public or gated), this is the recommended approach. Cached models provide the fastest cold starts and persist across worker restarts.
  2. Bake the model into your Docker image: For private models not on Hugging Face, embed them directly in your container image. This increases image size and initialization time, but ensures the model is stored directly on machine disk before the worker starts, so it’s ready to serve requests the moment billing begins.
  3. Use network volumes: For development workflows or very large models (500GB+), store models on a network volume. Reading from network volume will occur after a worker starts running and billing begins, and will be slower than reading cached or baked models directly from machine disk. However, worker initialization time will be faster, and changes to the underlying image will not require rebuilding and repushing the image with the model artifact, making it faster to iterate during development.

Worker types

Workers can run in two modes depending on your latency and cost requirements:
  • Active workers run continuously (24/7) and are always ready to process requests instantly. They eliminate cold starts entirely, making them ideal for latency-sensitive or high-traffic applications.
  • Flex workers scale dynamically based on demand, spinning down to zero when idle. They incur cold starts when scaling up but cost nothing when not in use, making them ideal for variable or sporadic workloads.
The system may also spin up extra workers during traffic spikes when Docker images are cached on hosts (default: 2).

Worker states

StateDescriptionBilling
InitializingDownloading image, loading code, and downloading cached models (if using model caching)No
IdleScaled down, waiting for requestsNo
RunningProcessing requestsYes
ThrottledTemporarily unable to run due to host resource constraintsNo
OutdatedMarked for replacement after updateYes (while processing)
UnhealthyCrashed; auto-retries for up to 7 daysNo
If an endpoint repeatedly produces unhealthy workers, Runpod automatically scales it down; see My endpoint was scaled down unexpectedly.
View worker states in the Workers tab of your endpoint in the Runpod console.

Max worker limits

Account balance determines your maximum workers (flex + active combined):
BalanceMax workers
Default5
$100+10
$200+20
$300+30
$500+40
$700+50
$900+60
Need more capacity? Contact support.

Best practices

PracticeBenefit
Optimize image sizeFaster downloads, reduced cold starts
Use model cachingFastest cold starts
Test locally firstCatch issues before deployment
Use logs and SSHDebug and optimize effectively