# Resource management and scaling

> Efficiently manage application resources with intelligent scaling controls for instances, workers, and services

Resource management and scaling
===============================

Manage your application resources efficiently with intelligent scaling and resource controls.

Application scaling
-------------------

Control how many instances of your application run simultaneously:

- Scale from 1 to 10 instances based on your needs
- Each instance gets the full allocated CPU and memory
- Instances are distributed across the infrastructure for reliability
- Zero-downtime scaling - add or remove instances without interruption

Worker scaling
--------------

Worker services scale automatically with your main application:

- Workers inherit the instance count from the main application
- When you scale your app to 3 instances, workers also scale to 3
- This ensures consistent background job processing capacity
- Workers share volumes with the main application for data access

Service scaling
---------------

Database and cache services can be scaled independently:

- Services maintain their own replica counts
- Scale services based on connection needs
- Services persist data across scaling operations
- No data loss when scaling up or down

Grace period management
-----------------------

When your billing grace period expires, resources are automatically managed:

- Applications and services scale down to 0 replicas
- Data remains preserved in persistent volumes
- Resources can be restored when billing is resolved
- No data loss during grace period scaling

Manual scaling controls
-----------------------

You can manually scale your resources at any time:

1. Navigate to your application's Resources tab
2. Adjust the instance count slider
3. Review the cost impact
4. Deploy to apply the changes

Scaling best practices
----------------------

### When to scale up

- Response times are increasing under load
- CPU or memory usage consistently above 80%
- Queue processing is falling behind
- You're expecting increased traffic

### When to scale down

- Resource usage consistently below 30%
- Traffic patterns show reduced demand
- Cost optimization is needed
- Development or staging environments during off-hours

Automatic scaling considerations
--------------------------------

While manual scaling gives you full control, consider these patterns:

- Scale up before major deployments or events
- Use multiple instances for production workloads
- Single instances are fine for development environments
- Monitor metrics to inform scaling decisions

Resource allocation
-------------------

Each instance receives guaranteed resources:

- **CPU**: Dedicated CPU allocation per instance
- **Memory**: Guaranteed memory per instance
- **Network**: Shared bandwidth across instances
- **Storage**: Shared persistent volumes across instances

Cost implications
-----------------

Scaling affects your costs linearly:

- 2 instances = 2x the base cost
- 3 instances = 3x the base cost
- Services scale independently with their own costs
- Review costs before applying scaling changes

Use scaling strategically to balance performance needs with cost efficiency.
