Python powers web backends, APIs, automation scripts, scrapers, data pipelines and machine-learning services. Each has different resource patterns, but they share the same foundations on a server: a reproducible environment, process management, and an understanding of how Python uses CPU cores. This guide covers those foundations and the specifics for each kind of workload. For step-by-step deployments, see our Django and FastAPI guides.
Interpreter and Environments
- Pin the Python version your project uses. The distribution's Python is fine if it matches; otherwise use uv, pyenv or the deadsnakes PPA on Ubuntu, or a Docker image.
- One isolated environment per project: a virtual environment or container, never global
pip installas root. - Lock dependencies with exact versions (
requirements.txtwith hashes, Poetry or uv lock files) so production matches what you tested.
# with uv (fast installer and project manager)
uv venv /srv/app/.venv --python 3.12
uv pip sync requirements.lock --python /srv/app/.venv/bin/python
The GIL and Multiple Cores
In standard CPython, the Global Interpreter Lock lets only one thread execute Python bytecode at a time per process. Threads still help with I/O-bound work (waiting on databases or HTTP), but CPU-bound Python code needs multiple processes to use multiple vCores. That is why Python web servers run several worker processes, and why data jobs use multiprocessing, concurrent.futures.ProcessPoolExecutor or libraries whose heavy work runs in C and releases the GIL (NumPy, pandas, many ML libraries). Free-threaded CPython builds exist in recent versions but are not yet the default for most production stacks.
Web Servers: WSGI and ASGI
| Framework | Interface | Server |
|---|---|---|
| Django (sync), Flask | WSGI | Gunicorn with sync or gthread workers |
| FastAPI, Starlette, async Django | ASGI | Uvicorn workers (directly or via Gunicorn's Uvicorn worker class) |
# Gunicorn for Django: 2 vCores → start with 5 sync workers
gunicorn project.wsgi:application --workers 5 --bind 127.0.0.1:8000 \
--timeout 30 --max-requests 1000 --max-requests-jitter 100
# FastAPI: one Uvicorn worker per vCore
uvicorn app.main:app --host 127.0.0.1 --port 8000 --workers 2
The traditional starting point for sync workers is (2 × vCores) + 1; async workers start at one per vCore. Then measure: each worker's memory multiplied by the worker count must fit in RAM alongside the database. --max-requests recycles workers to contain slow memory growth. Run the server under systemd and put Nginx in front for TLS and static files.
Async Is Not Automatically Faster
Async frameworks shine when requests spend most of their time waiting on I/O and you use async drivers throughout. A single blocking call (a synchronous database driver, requests, heavy CPU work) inside an async endpoint blocks every other request on that worker. Use async libraries end to end, run blocking code in a thread pool, and move CPU-heavy work to background jobs.
Background Jobs
Celery, RQ, Dramatiq and arq move slow work out of requests. Run workers as separate systemd services, set concurrency to match CPU for CPU-bound tasks, and use Redis or RabbitMQ as the broker (see our background workers guide). Celery's prefork pool uses processes, so it uses multiple vCores despite the GIL.
Scripts, Bots and Scrapers
Long-running scripts and bots should run as systemd services with restart policies, logs in journald and a heartbeat that alerts if they stop making progress. Scheduled scripts belong in cron or systemd timers with a lock to prevent overlaps. Scrapers using headless browsers need much more memory per worker than plain HTTP clients; size accordingly and respect target sites' terms and rate limits.
Data Processing and Machine Learning
- Use vectorised libraries: NumPy and pandas operations run in optimised C and can be orders of magnitude faster than Python loops.
- Control thread counts: BLAS libraries start a thread per core; when you also run several processes, set
OMP_NUM_THREADSto avoid oversubscription. - Chunk large datasets instead of loading everything into memory; consider Polars or DuckDB for larger-than-memory analytics.
- CPU inference: small and medium models run on CPU; use optimised runtimes (ONNX Runtime, quantised models) and batch requests. Large models need GPUs, which these VPS plans do not include.
Memory Planning
| Process | Typical memory |
|---|---|
| Django/Flask Gunicorn worker | 60–200 MB depending on the app |
| FastAPI Uvicorn worker | 50–150 MB |
| Celery worker process | Similar to a web worker, plus task data |
| pandas job | Several times the size of the data loaded |
| Headless browser for scraping | Hundreds of MB per browser |
Measure your own processes with ps -o rss or smem, and watch for growth over days.
Quick Performance Wins
- Use a current Python release; recent versions are noticeably faster.
- Cache database queries and rendered fragments in Redis.
- Avoid N+1 queries in ORMs (
select_related,prefetch_relatedin Django). - Profile before optimising:
cProfile,py-spy(attaches to running processes without restarting) or an APM tool. - Use connection pooling for databases and HTTP clients.
Security Basics
Run apps as unprivileged users, keep secrets in environment files outside the repository, disable debug mode (DEBUG = False in Django) and set allowed hosts, and keep dependencies updated with a tool that flags known vulnerabilities, such as pip-audit.
Sizing
| Workload | EPYC plan |
|---|---|
| Django/FastAPI app with database and a worker | 2 vCores / 8 GB |
| Busy API with Celery workers and Redis | 4 vCores / 16 GB |
| Data pipelines, scraping at scale, CPU inference | 8–16 vCores, 32–64 GB |
In Short
Isolate environments, run several worker processes, keep blocking work out of async code and plan memory per worker.
Next Steps
Deploy with our framework guides, then load test and adjust worker counts from measured memory.
SkyRainCloud Plans for This Workload
Python processes are memory-hungry compared with their CPU use: plan RAM per worker. 2 vCores / 8 GB runs a Django or FastAPI app with its database and a worker; data processing and ML inference benefit from 8–16 vCores and 32–64 GB.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.
Frequently Asked Questions
How do I run a Python web app in production?
How many Gunicorn workers should I use?
Does Python use multiple CPU cores?
Is async Python faster?
How should I manage Python versions on a server?
How do I run background tasks in Python?
Can I run machine learning on a CPU VPS?
Why does my pandas job run out of memory?
How do I profile a slow Python app?
Which EPYC plan suits Python applications?
Related Guides
- How to Deploy a Django Application on a VPS with Nginx
- How to Deploy a FastAPI Application on a VPS with Uvicorn and Nginx
- How to Host Background Workers and Queue Processing Systems on a VPS
- AMD EPYC VPS for Heavy CPU Workloads
- Python Automation VPS India from ₹649/mo
- Minecraft Hosting Chennai (AMD EPYC)
- Pterodactyl Panel Guide — Minecraft
- Fabric Minecraft Server Hosting 2026