Scale
Learn how to scale your Piglet Run resources up or down.
Overview
Piglet Run supports scaling:
- Database: Adjust PostgreSQL resources
- Storage: Expand disk capacity
- Services: Scale service resources
Quick Scale
Scale database resources:
pig scale db --cpu 4 --memory 8G
Scale Database
Increase Resources
pig scale db --cpu 4 --memory 16G
Adjust Connection Limits
pig scale db --max-connections 200
Configure Shared Buffers
pig scale db --shared-buffers 4G
Scale Storage
Expand Disk
pig scale storage --size 100G
Add Storage Volume
pig scale storage add --mount /data/extra --size 50G
Scale Services
VS Code Server
pig scale service vscode --memory 4G
JupyterLab
pig scale service jupyter --memory 8G
Resource Limits
View current resource allocation:
pig scale status
Example output:
Service CPU Memory Storage
--------- ---- ------ -------
PostgreSQL 2 4G 20G
VS Code 1 2G -
Jupyter 1 2G -
Nginx 0.5 512M -
Configuration
Scale settings in /etc/piglet/resources.yml:
resources:
postgres:
cpu: 2
memory: 4G
storage: 20G
vscode:
cpu: 1
memory: 2G
jupyter:
cpu: 1
memory: 2G
Best Practices
- Monitor resource usage before scaling
- Scale gradually to avoid disruption
- Test changes in development first
Next Steps
- Set up Monitoring
- Learn about Architecture