Best VPS Size for HAProxy Load Balancer
- Estimated vCPU cores
- cores
- Result
- Concurrent connections
- 10000
- You entered
- Average request size
- 4 KB
- You entered
The best VPS size for an HAProxy load balancer is a 2 vCPU / 4 GB RAM instance from a provider with fast networking, such as DigitalOcean’s Premium Droplet, Linode’s Dedicated CPU plan, or Vultr’s High Frequency Compute. This size handles most production workloads (up to ~50k concurrent connections) with headroom for TLS termination and health checks, without overspending on idle resources.
Formula
Estimated memory (MB) = (concurrent connections × 0.1) + (requests per second × 0.05) + 256. Estimated vCPU cores = ceil(requests per second / 5000) + 1. The 0.1 MB per connection accounts for socket buffers and session state; the 0.05 MB per request covers TLS and HTTP processing overhead; the 256 MB baseline is for the OS and HAProxy itself. The vCPU estimate assumes modern hardware and typical HTTP traffic.
Worked Example
Using the defaults: 10,000 concurrent connections and 1,000 requests per second. Memory = (10,000 × 0.1) + (1,000 × 0.05) + 256 = 1,000 + 50 + 256 = 1,306 MB. vCPU = ceil(1,000 / 5,000) + 1 = ceil(0.2) + 1 = 1 + 1 = 2. So a 2 vCPU / 2 GB VPS would be tight; 4 GB is safer.
What to Look For
When sizing a VPS for HAProxy, focus on these criteria:
- Network throughput: HAProxy is I/O-bound; a 1 Gbps or 10 Gbps network link matters more than raw CPU. Check the provider’s network speed and whether it’s metered.
- CPU performance: TLS termination (HTTPS) is CPU-intensive. Look for modern CPUs (e.g., AMD EPYC, Intel Xeon) and consider dedicated CPU plans if you handle many TLS connections.
- Memory: Each connection uses ~0.1 MB; 10,000 connections need ~1 GB. Add 256 MB for the OS and HAProxy. 2 GB is the practical minimum; 4 GB is comfortable.
- Disk I/O: HAProxy doesn’t store data, but logs and stats can write to disk. An SSD or NVMe is fine; avoid cheap HDD VPS.
- Provider reliability: Uptime SLA, DDoS protection, and support quality matter for a load balancer that fronts your entire stack.
- Scalability: Choose a provider where you can resize or add another VPS without migrating.
Recommended VPS Options
1. DigitalOcean Premium Droplet (2 vCPU / 4 GB)
Strengths: Fast NVMe storage, 2 Gbps network, AMD EPYC CPUs, and a simple control panel. Great documentation and community tutorials for HAProxy. Costs about $24/month.
Trade-offs: Network is metered (2 TB transfer included); extra bandwidth costs. No free DDoS protection beyond basic L3/L4.
Who it suits: Small to medium production sites, startups, and developers who want a straightforward setup.
2. Linode Dedicated CPU (2 vCPU / 4 GB)
Strengths: Guaranteed CPU cores (no noisy neighbors), 40 Gbps network (shared), and 4 GB RAM. Good for TLS-heavy workloads. ~$30/month.
Trade-offs: Slightly pricier than shared CPU plans. Network is shared, so peak throughput varies.
Who it suits: Applications with high TLS termination needs or consistent CPU demand.
3. Vultr High Frequency Compute (2 vCPU / 4 GB)
Strengths: 3 GHz+ CPU, NVMe storage, and up to 2 Gbps network on some plans. Competitive pricing (~$24/month).
Trade-offs: Network speed varies by location; some regions have older hardware.
Who it suits: Latency-sensitive apps and users who want a balance of price and performance.
4. Hetzner Cloud CX22 (2 vCPU / 4 GB)
Strengths: Extremely affordable (~€5.50/month), 20 TB traffic included, NVMe storage, and 2 Gbps network. Excellent value.
Trade-offs: Support is less personal; DDoS protection is basic. Data centers are mainly in Europe and the US.
Who it suits: Budget-conscious projects, homelabs, and EU-based deployments.
5. AWS t3.medium (2 vCPU / 4 GB)
Strengths: Burstable CPU for low average usage, 5 Gbps network (up to 5 Gbps), and integration with AWS services. On-demand ~$30/month, but reserved instances are cheaper.
Trade-offs: CPU credits can run out under sustained load; network performance is burstable and not guaranteed. Setup is more complex.
Who it suits: Teams already in AWS who need tight integration with VPC, IAM, and CloudWatch.
6. OVHcloud VPS (2 vCPU / 4 GB)
Strengths: Very low cost (~$10/month), unmetered 2 Gbps network, and built-in DDoS protection. Good for high-traffic sites on a budget.
Trade-offs: Support is often slower; CPU is older (Intel Xeon E3). Performance can be inconsistent.
Who it suits: High-volume traffic with limited budget, especially if you have your own ops expertise.
How to Choose
Start with your budget. If you can spend $20–30/month, go with DigitalOcean, Linode, or Vultr. If you need the absolute cheapest, Hetzner or OVH are hard to beat. Then consider your traffic: for under 5,000 concurrent connections and light TLS, a 1 vCPU / 2 GB VPS may suffice, but 2 vCPU / 4 GB is the sweet spot for most production workloads. If you terminate TLS on HAProxy, allocate more CPU; if you offload TLS to a CDN or cloud load balancer, you can get away with less. Also think about high availability: you might want two smaller VPSs (e.g., 1 vCPU / 2 GB) in different regions with keepalived, rather than one big one. Finally, check the provider’s network speed and data transfer caps—a load balancer can consume a lot of bandwidth.
Frequently Asked Questions
Can I run HAProxy on a 1 GB RAM VPS?
Yes, for small traffic (<2,000 concurrent connections) and no TLS, 1 GB is enough. But you'll be close to memory limits; 2 GB is safer.
How many connections can a 2 vCPU / 4 GB VPS handle?
With keep-alive connections, HAProxy can handle tens of thousands of idle connections. For active requests, expect 10,000–50,000 per second depending on request size and TLS.
Should I use a dedicated CPU plan?
If you have sustained high CPU usage (e.g., lots of TLS handshakes), yes. For bursty traffic, shared CPU is fine and cheaper.
Do I need a load balancer VPS with more than 4 GB RAM?
Rarely. HAProxy is efficient; 4 GB supports ~40,000 concurrent connections. Only go higher if you run many health checks or extensive logging.
What about bandwidth limits?
Check the provider’s data transfer cap. A busy load balancer can push 1–2 TB/month. Providers like Hetzner and OVH offer unmetered or high caps.
Is it better to use a cloud load balancer instead of HAProxy?
Cloud load balancers (like AWS ALB) are managed and scale automatically, but cost more. HAProxy gives you control and is cheaper at scale, but you manage it yourself.
Bottom Line
For most teams, the best choice is a 2 vCPU / 4 GB VPS from DigitalOcean, Linode, or Vultr—it balances cost, performance, and reliability. If budget is tight, Hetzner offers the same specs at half the price. Start with 2 vCPU / 4 GB, monitor CPU and memory, and scale up only if needed. Always set up a second instance for high availability if your traffic is critical.
Related
Formula used
in t | Concurrent connections | - | 10000 | 0 in b | Average request size | KB | 4 | 0 in r | Requests per second | - | 1000 | 0 out mem | Estimated memory (MB) | MB | (t * 0.1) + (r * 0.05) + 256 | 0 out cpu | Estimated vCPU cores | cores | ceil(r / 5000) + 1 | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.