Hosting 5,000 Dynamic Websites on a 2-Core 4GB Server: A High-Density Architecture Deep Dive

A 2-core 4GB VPS hosting 5,000 dynamic sites via shared runtimes and on-demand loading.
A Show HN project demonstrated serving 5,000 dynamic websites on a single 2 vCPU / 4 GB RAM VPS, challenging the assumption that growth requires hardware scaling. The approach combines three techniques: a shared runtime with Host-header-based request-level isolation to decouple site count from resource usage; LRU-based on-demand data loading so only the active working set occupies RAM; and an async event-driven concurrency model to handle massive connections with minimal threads. Crucially, "5,000 sites" means registered capacity, not simultaneous high concurrency — a realistic fit for long-tail, low-traffic site-building businesses. For SaaS platforms and multi-tenant providers, maximizing per-machine tenant density is a direct lever on unit economics.
A Counter-Intuitive Performance Experiment
As cloud computing costs remain stubbornly high, many developers hold a deeply ingrained instinct: when traffic grows, add more machines and scale up resources. Yet a Show HN project on Hacker News proposed something genuinely striking — they served 5,000 dynamic websites simultaneously on a VPS with just 2 vCPUs and 4 GB of RAM.
At first glance, the number seems almost impossible. Under traditional frameworks (PHP-FPM, Node.js process pools, or Rails), running a few hundred dynamic sites can already exhaust a small server's memory. Five thousand dynamic sites implies extreme deployment density — less than 1 MB of memory per site on average. Behind this must lie a carefully engineered server architecture.
Why High-Density Hosting Deserves Attention
For indie developers, SaaS website builders, and multi-tenant service providers, "how many sites can a single machine handle" directly determines the cost structure of the business model. If a VPS costing a few dollars a month can sustain thousands of sites, the marginal cost of a website-building service drops to an extremely low level — creating a significant competitive advantage.
Resource Bottlenecks of Traditional Architectures at High Density
The traditional "one process per site" model has two critical problems in high-density hosting scenarios:
- Memory usage scales linearly: Every independent application process consumes a fixed amount of runtime memory (an idle Node.js process typically uses 30–50 MB). As process count grows linearly, available memory is rapidly exhausted.
- CPU context-switching overhead is costly: The scheduling pressure from thousands of processes causes the CPU to spend significant cycles on context switching, leaving far less time for actual business logic.
Fitting 5,000 sites into 4 GB of RAM is therefore nearly impossible using the conventional "one process per site" approach.
Core Technical Approaches Behind 5,000-Site Hosting
Although the original post reveals limited technical details, reverse-engineering this goal reveals several key techniques that typically combine to achieve such high-density dynamic website hosting.
Shared Runtime + Request-Level Isolation
The most viable approach is to have all sites share a single application runtime, routing each request to the appropriate site's logic and data based on the Host header. Memory consumption no longer grows with the number of sites — it grows with the number of concurrent requests.
Among 5,000 sites, the vast majority are idle at any given moment. Only the handful of requests currently being processed actually need CPU and memory. This model fundamentally decouples "number of sites" from "resource consumption" — no matter how large the static inventory, a small server can handle it comfortably as long as active concurrency remains manageable.
On-Demand Dynamic Loading of Data and Configuration
Each site's templates, configuration, and content are loaded on demand from a database or cache rather than kept resident in memory. Combined with an LRU (Least Recently Used) cache strategy, popular sites' data stays cached in memory for fast responses, while cold sites' data is evicted to disk or the database — trading time for space.
This design ensures that only the active working set fits within 4 GB of RAM, rather than the complete data for all 5,000 sites.
Efficient Connection and Concurrency Model
Using an asynchronous, event-driven server architecture (such as implementations based on Go, Rust, or the Node.js event loop) allows a tiny number of threads or coroutines to handle massive concurrent connections, avoiding the resource waste of traditional multi-process models. Compared to the blocking one-thread-per-connection model, event-driven architecture achieves memory efficiency that is an order of magnitude better in high-density scenarios.
The Real-World Context Behind 5,000 Dynamic Sites
While the number is impressive, it's worth examining what it actually means. "Serving 5,000 dynamic websites" is more accurately described as: the system has 5,000 registered sites and can serve a dynamic response for any of them — not "5,000 sites simultaneously handling high-concurrency traffic."
The key variables that determine how this architecture actually performs include:
- Actual QPS (queries per second): If most of these sites are low-traffic personal blogs or marketing landing pages, the total request volume may not be high at all.
- Complexity of dynamic computation: Simple template rendering versus complex database queries or external API calls consumes wildly different levels of resources.
- Cache hit rate: If dynamic content can be effectively cached (via page-level or fragment caching), the frequency of actually triggering "dynamic" computation drops dramatically.
In other words, this is more of an architectural feasibility proof for high-density multi-tenant hosting than the result of a brute-force performance stress test. Even so, it remains highly relevant — because many real-world website-building businesses consist precisely of this kind of long-tail distribution dominated by low-traffic sites.
Architectural Lessons for Developers and SaaS Teams
The greatest value of this case study lies in challenging the reflexive habit of "throwing hardware at the problem." It offers three important architectural design principles:
- Architecture choices matter far more than hardware specs. A well-designed shared runtime can push a cheap VPS well beyond expected limits, while blindly scaling up simply transfers the cost of architectural flaws onto your cloud bill.
- Multi-tenant density is a core competitive advantage for SaaS website platforms. Whoever can safely and reliably host more tenants per machine has lower per-unit costs and higher margins.
- "Number of sites" is not the same as "load." System design should focus on managing resources for concurrent requests and handling peak traffic, not on static entity counts.
For teams building website tools, multi-tenant SaaS platforms, or edge rendering services, this kind of practice points to a direction worth exploring deeply: using clever software-layer design to compress cloud server costs to an absolute minimum.
Closing: The Engineering Beauty of Single-Machine Optimization
The Show HN post has attracted limited discussion so far and lacks more detailed technical disclosures. But the proposition it raises is thought-provoking in its own right — in an era where everyone chases elastic scaling and casually reaches for Kubernetes clusters, stepping back to squeeze every last drop out of a single machine and keep the architecture flat may be the more pragmatic path to cost control.
True engineering elegance often lies not in how many resources you use, but in how few.
Related articles

Insufficient Source Material to Generate a Valid Article
The provided source material is a single unrelated tweet with no AI or tech relevance — insufficient to support a complete, valid technical article.

Insufficient Source Material to Generate a Valid AI/Tech Article
This source material is a tweet about the ages of Underworld members — unrelated to AI or tech, and insufficient to support a full article.

Insufficient Material: Unable to Generate a Valid AI/Tech Article
The provided material is a condolence tweet about a San Diego mosque attack — unrelated to AI/tech and too limited to generate a valid technical article.