How Much RAM and CPU Does Your Web App Need?
By Daniel Mercer · Published · 4 min read

Most over-provisioned servers are not a technical problem, they are a guess. Someone picked 8 vCPU and 16 GB because it felt safe, and nobody has revisited it since. Sizing gets much easier once you break it into three questions: how many requests arrive per second, how long each one occupies a worker, and how much of that work leans on the database.
This guide gives you formulas you can run on the back of an envelope, realistic ranges for common stacks, and the headroom rules that keep a sizing decision safe without doubling your bill. The numbers are starting points for measurement, not guarantees, but they will get you within roughly one tier of the right machine.
Start With Concurrency, Not Visitors
Monthly visitor counts tell you almost nothing about server load. What matters is peak concurrent requests: how many requests are in flight at the same moment. A site with 200,000 monthly visits might peak at 8 requests per second, while a smaller B2B app with 40 logged-in users polling dashboards can hit 60. Pull the peak from your access logs or load balancer metrics rather than the marketing analytics dashboard.
Convert that to concurrency with Little's Law: concurrency equals arrival rate multiplied by average response time. At 40 requests per second and 250 ms average handling time, you have roughly 10 requests in flight. That is the number your worker pool and memory budget must cover, and it scales linearly with any slowdown you introduce.
- Peak requests per second, measured over 5-minute windows
- Average and p95 response time per request type
- Share of requests that hit the database versus cache
- Number of concurrent background jobs and cron tasks
A Simple RAM Formula for App Servers
Application memory is mostly fixed overhead plus per-worker cost. For a PHP-FPM or Node.js process, budget 40–90 MB per worker for a typical framework app, 150–250 MB if you load heavy libraries or large in-memory caches. Add the operating system and services (around 500 MB–1 GB), then multiply workers by peak concurrency with a safety factor.
A worked example: 10 concurrent requests, 80 MB per worker, 1.5x safety factor, plus 1 GB system overhead gives roughly 2.2 GB, so a 4 GB instance fits comfortably. For Python or Java stacks, per-process memory is much higher, often 300 MB–1 GB, and JVM heap sizing deserves its own budget line. Always leave 20–30% of RAM unused so the kernel can cache files and absorb spikes.
- Fixed: OS, agents, container runtime: 0.5–1.5 GB
- Per worker: 40–90 MB (PHP/Node), 300 MB+ (Python/Java)
- Safety multiplier: 1.3–1.5 on worker memory
- Target steady-state utilisation: 60–75% of total RAM
CPU Sizing From Request Throughput
CPU is easier to reason about per request. Measure CPU-seconds consumed per 1,000 requests under realistic load; a lean API endpoint might use 0.05 CPU-seconds per request, a template-heavy page 0.3–0.8. Multiply by peak requests per second to get the cores you actually need, then add headroom for garbage collection, TLS handshakes and logging.
As a rule of thumb, keep sustained CPU below 60–70% at peak. Above that, queueing delays grow faster than load, and a single slow query can cascade. If you run containers with CPU limits, remember that throttling starts before the node is busy, so set requests honestly and limits 1.5–2x above requests.
- Measure CPU-seconds per 1,000 requests on a staging copy
- Keep peak CPU at 60–70% of allocated cores
- Reserve 1 core for the OS and monitoring agents
- Re-measure after every major dependency upgrade
| Workload | Peak req/s | Suggested vCPU | Suggested RAM | Notes |
|---|---|---|---|---|
| Small brochure site with cache | 10–30 | 1–2 | 2 GB | CDN handles most traffic |
| CMS with logged-in editors | 20–50 | 2 | 4 GB | Cache pages, not admin |
| API with light queries | 50–150 | 2–4 | 4–8 GB | Watch connection pools |
| App with heavy reporting | 30–80 | 4 | 8–16 GB | Separate analytics queries |
| Database (small production) | n/a | 2–4 | 8 GB | Working set under 4 GB |
| Queue workers and cron | n/a | 1–2 | 2–4 GB | Memory grows with batch size |
Budgeting for the Database Layer
Databases behave differently from app servers: they want memory for caching and fast disks, and they punish CPU contention. The working set is the portion of your data and indexes actively queried. If your working set fits in RAM, reads are served from the buffer pool and latency stays flat. Once it does not, disk IOPS becomes the bottleneck, not CPU.
For MySQL or PostgreSQL, a common starting point is to give the buffer pool or shared buffers 25–40% of total RAM, leaving the rest for connections and the OS. Each connection costs 5–10 MB, so a 200-connection pool needs 1–2 GB before any caching. Start databases at 4–8 GB RAM for small production workloads and scale memory before cores.
- Working set under 2 GB: 4 GB RAM database is usually fine
- Give 25–40% of RAM to the buffer pool
- Each connection: 5–10 MB plus query memory
- Scale memory before adding database cores
Headroom, Autoscaling and the Cost Trade-off
Headroom is insurance, and like insurance it should be priced. Running at 50% average utilisation on a fixed instance wastes money; running at 85% invites incidents during deploys, backups or a traffic spike. The compromise most teams land on is 60–70% peak utilisation with horizontal autoscaling triggered at 65% CPU or rising queue depth.
Autoscaling only helps if the app is stateless and sessions live outside the instance. If sessions or uploads sit on local disk, adding instances breaks things faster than it fixes them. Sizing and architecture are the same conversation, which is why a clear picture of how cloud and shared hosting differ in resource isolation matters before you pick instance sizes.
Validate With Load Tests, Then Revisit Quarterly
Formulas give you a starting tier; a load test gives you the truth. Run a test at 2x expected peak for 30 minutes and watch p95 latency, error rate, CPU and memory. If latency stays flat and memory is stable, you can safely drop a tier. If latency climbs before CPU saturates, the bottleneck is elsewhere: locks, connection pools or slow queries.
Sizing is not a one-time task. Traffic mix, framework versions and query patterns drift, and a machine that was right in January may be oversized in June. Review metrics quarterly against actual peaks, and keep a note of why each tier was chosen. When growth outpaces vertical scaling, it is time to look at moving from a VPS to full cloud infrastructure rather than buying a bigger single box.
- Size from peak concurrency and per-request cost, not monthly visitors
- Budget 40–90 MB per worker for PHP or Node, far more for Python and Java
- Keep peak CPU at 60–70% and leave 20–30% of RAM free
- Load test at 2x expected peak before you commit to a tier
Daniel has spent years writing plain-language guides about web hosting and cloud infrastructure for small business owners. He focuses on turning technical plan details into practical budgeting and buying advice. He reviews every article on Rakusoit for clarity and accuracy before publication.


