Scale for Traffic
Temps lets you control how much CPU and memory each container gets, and how many containers (replicas) run for each environment. Scale vertically by increasing resources, or horizontally by adding replicas.
Check current resource usage
Before changing anything, check what your application is actually using.
- Open your project in the dashboard
- Click Monitoring in the project sidebar
- Select the environment and container you want to inspect
The metrics dashboard shows real-time data via Server-Sent Events:
- CPU Usage — percentage of allocated CPU
- Memory Usage — bytes consumed and percentage of the memory limit
- Network Traffic — inbound and outbound data transfer rates
You can also get metrics from the API:
curl "https://your-temps-instance/api/projects/{project_id}/environments/{env_id}/containers/{container_id}/metrics" \
-H "Authorization: Bearer YOUR_TOKEN"
Response:
{
"cpu_percent": 45.2,
"memory_bytes": 536870912,
"memory_percent": 62.5,
"memory_limit": 858993459,
"network_rx_bytes": 1048576,
"network_tx_bytes": 524288
}
Adjust CPU and memory limits
Resource limits are configured per environment. This lets you allocate more resources to production while keeping staging lightweight.
- Open your project
- Click Environments in the sidebar
- Click on the environment you want to scale (e.g. production)
- Go to Settings
- Adjust the resource fields:
- Name
CPU Request- Description
The minimum CPU guaranteed to the container, in millicores.
1000= 1 full CPU core. If not set, Docker allocates CPU dynamically.
- Name
CPU Limit- Description
The maximum CPU the container can use. The container is throttled if it exceeds this.
2000= 2 CPU cores.
- Name
Memory Request- Description
The minimum memory guaranteed, in MB. If not set, Docker allocates memory dynamically.
- Name
Memory Limit- Description
The maximum memory the container can use, in MB. If the container exceeds this, it is killed (OOM) and restarted. Set this to avoid a single container consuming all server memory.
- Name
Replicas- Description
The number of container instances to run. Default:
1. Increase to handle more concurrent requests.
Click Save. Changes take effect on the next deployment. To apply immediately, click Redeploy on the current deployment.
Add replicas
Running multiple replicas of your application distributes load across containers. Temps' reverse proxy automatically load-balances requests across all healthy replicas.
To add replicas:
- Go to your environment's Settings
- Set Replicas to the desired count (e.g.
3) - Save and redeploy
What replicas share
- The same Docker image and environment variables
- The same linked managed services (database, Redis)
- The same domain and SSL certificate
What replicas do not share
- Memory and CPU — each replica has its own allocation
- Local filesystem — do not store state on disk; use the database or KV storage instead
- In-memory caches — each replica has its own memory space
Stateless applications work best. If your application stores session data in memory, switching to Redis sessions before adding replicas ensures users get consistent behavior regardless of which replica handles their request.
Change the exposed port
If your application listens on a port other than 3000, configure it in the environment settings:
- Go to your environment's Settings
- Set Exposed Port to the port your application listens on
- Save and redeploy
Temps resolves the port in this order:
EXPOSEdirective in your Dockerfile- Exposed port setting on the environment
- Exposed port setting on the project
- Default:
3000
Scale via the API
Update environment settings programmatically:
curl -X PUT "https://your-temps-instance/api/projects/{project_id}/environments/{env_id}/settings" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cpu_limit": 2000,
"memory_limit": 1024,
"replicas": 3,
"exposed_port": 8080
}'
After updating, trigger a redeploy for the changes to take effect.
When to scale up
| Symptom | Likely cause | Action |
|---|---|---|
| CPU consistently above 80% | Application is compute-bound | Increase CPU limit or add replicas |
| Memory approaching limit | Large datasets in memory, or memory leak | Increase memory limit; investigate leaks if usage keeps growing |
| Container restarts (OOM) | Memory limit too low | Increase memory limit |
| Slow response times under load | Too few replicas | Add replicas to distribute requests |
| High response times, low CPU | Application is I/O-bound (waiting on database) | Optimize queries, add Redis caching, or increase database resources |
Scaling your database
Managed services have their own resource configuration. If your PostgreSQL database is the bottleneck:
- Increase
max_connectionsin the service settings - Use connection pooling in your application (e.g. PgBouncer or built-in pool)
- Optimize slow queries using the data explorer in the dashboard
Temps does not currently support auto-scaling. Replica count and resource limits are set manually. Monitor your metrics and adjust as traffic patterns change.