Urgent.News

What's breaking now, across thousands of outlets.

Tech

How One 2-vCPU VPS Hosts 5,000 Dynamic Sites and Renders a 10-Blog-Item Page in Under 1 ms?

For years, I saw companies maintain hundreds of servers to host WordPress websites for their clients. A new VPS was needed for roughly every 10 websites. Yet each page could still take around 100 ms to render. Multilingual websites often made the situation worse. The site could still be slow when only one user was visiting it. The usual response was to add another cache layer, a CDN or another…

In a groundbreaking experiment, a single 2-vCPU, 4-GB Virtual Private Server (VPS) managed to host an astounding 5,000 independent dynamic websites, rendering a page containing ten blog items in under 1 millisecond. This remarkable feat was achieved by designing a new architecture that integrated the web server, database engine, and render engine into one system, eliminating unnecessary work at every boundary between separate services.

The traditional approach to hosting multiple websites on a VPS often involves hundreds of servers, with each page taking around 100 milliseconds to render. Even with caching and content delivery networks (CDNs), the process remains slow, especially for multilingual websites or when only one user is visiting the site.

To overcome this issue, the developers rethought how dynamic websites should render a page. They aimed to make a simple operation - receiving a request, finding the site, finding the route, loading the data, and rendering the page - as efficient as possible. After extensive testing and observation, two surprising results emerged:

1. Five thousand independently addressable dynamic websites could be operated on one small server while still rendering real dynamic content.

2. A dynamic page with ten blog items rendered in under 1 millisecond on the prepared server-render path.

These results were obtained through controlled benchmarks with different measurement boundaries, ensuring the findings were accurate and reliable. The reports, raw data, and reproduction materials are publicly available for further analysis.

The key to this impressive performance lies in the system's design. By removing the traditional request pipeline and integrating the web server, database engine, and render engine, the developers reduced the time spent at every boundary between separate services. The request no longer needs to cross a process boundary to query the database, and the renderer does not have to serialize intermediate results into another format before using them.

This streamlined approach removes unnecessary work from the hot path, allowing for faster page rendering.

Furthermore, using an integrated database and render engine provides control over the complete path from data to HTML. The database returns a specific result tailored to the request, and the render engine understands the page structure, data query, and output buffer as one operation. This optimization reduces repeated conversions and allocations, enabling the reuse of buffers and writing the completed output directly to the network.

The 5,000-site capacity benchmark and the sub-millisecond rendering benchmark demonstrated the system's potential. The capacity benchmark recorded 5,000 independent dynamic sites, 90,000 planned HTTPS requests, and verified 89,969 responses with 99.97% first-attempt success. The rendering benchmark showed that 98.3045% of renders completed in under 0.5 milliseconds, with 99.001% below 1 millisecond. The p50, p95, and p99 values further emphasize the system's exceptional performance.

These benchmarks demonstrate the power of this architecture for a defined workload, proving that this approach can handle thousands of independently addressable dynamic websites with sub-millisecond rendering times. However, it does not guarantee that every possible collection of 5,000 production websites will behave identically. The results showcase the potential of this architecture to significantly improve website performance, but further optimization may be needed for different use cases.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

EU Kids act: The EU’s plan to make the internet safer for kids

The new EU KIDS ACT bans social media for under-13s but allows "mini accounts" for 13-15-year-olds. No infinite scrolling, push notifications, and contacts from strangers.

  • EU Kids Act aims to enhance online child safety.
  • Minimum age requirement set for social media accounts.
  • Ban on accounts for individuals under 13.

More from Tuesday 22 September →