Resource Sizing
Right-size your sandbox resources for optimal performance:- Python
- JavaScript/TypeScript
Reuse Sandboxes
Reuse sandboxes for multiple operations to avoid startup overhead:- Python
- JavaScript/TypeScript
Parallel Execution
Run independent operations in parallel:- Python
- JavaScript/TypeScript
Optimize Code Execution
Write efficient code for better performance:- Python
- JavaScript/TypeScript
Monitor Performance
Monitor sandbox performance to identify bottlenecks:- Python
- JavaScript/TypeScript
Best Practices Summary
✅ DO: Right-Size Resources
✅ DO: Right-Size Resources
Match resources to your workload:
- Lightweight: 1 vCPU, 512MB RAM
- Data analysis: 4 vCPU, 4GB RAM
- ML training: 16 vCPU, 16GB RAM
✅ DO: Reuse Sandboxes
✅ DO: Reuse Sandboxes
Reuse sandboxes for multiple operations to avoid startup overhead.
✅ DO: Run Operations in Parallel
✅ DO: Run Operations in Parallel
Run independent operations in parallel to reduce total execution time.
✅ DO: Use Vectorized Operations
✅ DO: Use Vectorized Operations
Use vectorized operations (NumPy, Pandas) instead of Python loops.
✅ DO: Monitor Performance
✅ DO: Monitor Performance
Monitor CPU, memory, and execution time to identify bottlenecks.
❌ DON'T: Over-Provision Resources
❌ DON'T: Over-Provision Resources
Don’t use more resources than needed - it increases costs without improving performance.
❌ DON'T: Create Sandboxes Unnecessarily
❌ DON'T: Create Sandboxes Unnecessarily
Don’t create a new sandbox for each operation - reuse when possible.

