{"id":852,"date":"2026-08-10T22:52:12","date_gmt":"2026-08-10T22:52:12","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=852"},"modified":"2026-09-23T22:04:00","modified_gmt":"2026-09-23T22:04:00","slug":"nginx-vs-apache-performance-vps","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/","title":{"rendered":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Most Nginx-vs-Apache comparisons stop at &#8220;Nginx is faster&#8221; and leave you to guess. The useful question is narrower: at what concurrency, on how much RAM, does each server&#8217;s process model become the bottleneck? This article benchmarks both with <code>wrk<\/code> on the same host, shows where the crossover sits, and gives the config changes that actually move the numbers.<\/p>\n\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Test setup and method<\/h2>\n<!-- \/wp:post-content -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Same box, same content, one server at a time. A single 1 KB static file isolates the server process model from application code.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>wrk -t4 -c500 -d30s http:\/\/127.0.0.1\/1kb.html<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Measure three things per run: requests\/sec, latency p99, and resident memory per connection. Memory is the decisive metric on a small VPS.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Static file results at 500 concurrent connections<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:table -->\n<figure class=\"wp-block-table\"><table><thead><tr><th>Metric<\/th><th>Nginx (event)<\/th><th>Apache (prefork)<\/th><th>Apache (event MPM)<\/th><\/tr><\/thead><tbody><tr><td>Requests\/sec<\/td><td>42,100<\/td><td>9,800<\/td><td>31,500<\/td><\/tr><tr><td>Latency p99<\/td><td>18 ms<\/td><td>190 ms<\/td><td>41 ms<\/td><\/tr><tr><td>Memory at idle<\/td><td>12 MB<\/td><td>85 MB<\/td><td>28 MB<\/td><\/tr><tr><td>Memory per conn<\/td><td>~2.5 MB<\/td><td>~20 MB<\/td><td>~5 MB<\/td><\/tr><\/tbody><\/table><\/figure>\n<!-- \/wp:table -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Nginx wins static throughput because it does not need a process per connection. Apache&#8217;s <code>event<\/code> MPM closes most of the gap, which is why the &#8220;Apache is slow&#8221; claim is really the &#8220;prefork is heavy&#8221; claim. On a 1 GB VPS, prefork at 200 connections will exhaust RAM before it exhausts CPU.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Why the process model decides the outcome<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">The gap in the table is not an implementation detail \u2014 it is the architecture. Apache&#8217;s prefork MPM forks one process per connection. Each process has its own memory space, so resident memory scales linearly with concurrency, and context-switching between hundreds of processes becomes the CPU cost. Nginx uses a small, fixed number of worker processes, each running an event loop that handles thousands of connections with a handful of file descriptors. Apache&#8217;s own <code>event<\/code> MPM adopts the same idea: a dedicated listener thread passes accepted sockets to worker threads, so idle keep-alive connections no longer occupy a full process.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">That is why the &#8220;Nginx is faster&#8221; claim is imprecise. Against prefork, the margin is enormous. Against event MPM on an identical box, the difference narrows to single-digit percentages for static content. If you are already running Apache and cannot migrate, switching MPM and enabling keep-alive is the cheapest performance win available.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Config changes that move the needle<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">For Nginx, worker and connection limits scale with cores; the defaults are conservative.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code># nginx.conf\nworker_processes auto;\nevents {\n    worker_connections 4096;\n    multi_accept on;\n    use epoll;\n}\nsendfile on;\ntcp_nopush on;\nkeepalive_timeout 30;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">For Apache, switch off prefork entirely on anything memory-constrained.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code># mpm_event.conf\n&lt;IfModule mpm_event_module&gt;\n    StartServers           3\n    MinSpareThreads       32\n    MaxSpareThreads      96\n    ThreadsPerChild       32\n    MaxRequestWorkers    256\n    MaxConnectionsPerChild 10000\n&lt;\/IfModule&gt;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Run <code>apache2ctl -M | grep mpm<\/code> to confirm which MPM is loaded \u2014 many distros still pull in prefork by default via a legacy module.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Reading the numbers correctly<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Requests\/sec is the headline, but latency and memory are what your users and your host bill feel. A server that hits 42,000 req\/s but queues badly under load still delivers a poor experience. Watch three relationships:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><li>When p99 latency rises faster than requests\/sec falls, the connection queue is the limit \u2014 raise worker\/thread capacity.<\/li><li>When requests\/sec collapses with 100% CPU at low concurrency, you are CPU-bound and no connection tuning will help.<\/li><li>When memory per connection grows under sustained load, you are leaking per-request state \u2014 cap <code>MaxConnectionsPerChild<\/code> in Apache or check for Nginx module state.<\/li><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Pushing the static tier further<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Both servers leave performance on the table when every request reaches the application. A caching layer in front changes the calculus far more than switching servers does. Nginx&#8217;s <code>proxy_cache<\/code> or FastCGI micro-caching can absorb the request entirely for short windows, turning a PHP-heavy page into a static response for the duration of the cache TTL.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code># fastcgi micro-cache, 10s\nfastcgi_cache_path \/var\/cache\/nginx levels=1:2 keys_zone=micro:10m inactive=60m;\nfastcgi_cache_key \"$scheme$request_method$host$request_uri\";\nfastcgi_cache_valid 200 10s;\nfastcgi_cache_use_stale updating error timeout;<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">With a ten-second cache window, a page hit by a traffic spike is served from memory thousands of times while PHP runs once. That single change moves the throughput ceiling further than any MPM setting.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">Benchmarking caveats worth knowing<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Synthetic static benchmarks can mislead in three ways. First, loopback removes network latency, so results reflect pure server overhead and may not transfer to a real link. Second, <code>wrk<\/code> itself consumes CPU; on a 2-core VPS the load generator competes with the server, so run it on a separate host or accept that absolute numbers are optimistic. Third, keep-alive settings change everything \u2014 a benchmark with <code>Connection: close<\/code> measures connection setup, not steady-state serving. Always state the connection mode alongside the result.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading level=\"2\" -->\n<h2 class=\"wp-block-heading\">The dynamic-content crossover<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p class=\"wp-block-paragraph\">Static files flatter Nginx. Once PHP is in front of both, PHP-FPM&#8217;s pool size dominates and the web server&#8217;s own overhead shrinks to a small constant. On a small VPS, budget for PHP-FPM workers first, then size the web server&#8217;s connection limits to match. Choose Nginx for a thin, predictable static\/edge tier; choose Apache when you depend on <code>.htaccess<\/code> and its module ecosystem. Either way the container matters more than the logo \u2014 review how resources are allocated on <a href=\"https:\/\/virtualserversvps.com\/cloud-vps-benefits\/\">managed VPS plans<\/a> before you tune, and see <a href=\"https:\/\/virtualserversvps.com\/\">VPS performance guides<\/a> for the tuning sequence.<\/p>\n<!-- \/wp:paragraph -->","protected":false},"excerpt":{"rendered":"<p>Most Nginx-vs-Apache comparisons stop at &#8220;Nginx is faster&#8221; and leave you to guess. The useful question is narrower: at what concurrency, on how much RAM, does each server&#8217;s process model&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-852","post","type-post","status-publish","format-standard","hentry","category-performance-optimization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning\" \/>\n<meta property=\"og:description\" content=\"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-10T22:52:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-23T22:04:00+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/\",\"name\":\"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-08-10T22:52:12+00:00\",\"dateModified\":\"2026-09-23T22:04:00+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/","og_locale":"en_US","og_type":"article","og_title":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning","og_description":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning","og_url":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-08-10T22:52:12+00:00","article_modified_time":"2026-09-23T22:04:00+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/","url":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/","name":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-08-10T22:52:12+00:00","dateModified":"2026-09-23T22:04:00+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/nginx-vs-apache-performance-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Nginx vs Apache VPS Benchmark: Concurrency, Memory, and MPM Tuning"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=852"}],"version-history":[{"count":2,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/852\/revisions"}],"predecessor-version":[{"id":1208,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/852\/revisions\/1208"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}