Console Login
Home / Blog / Server Administration / Apache vs Lighttpd in 2012: Squeezing Performance from Your Norway VPS
Server Administration ‱ ‱ 14 views

Apache vs Lighttpd in 2012: Squeezing Performance from Your Norway VPS

@

The Memory War: Why Your Web Server Choice Matters

If you have ever stared at top and watched your swap usage climb while your server crawls to a halt, you know the pain. It is January 2012, and while hardware is getting cheaper, RAM is still the most precious resource on any Virtual Private Server (VPS). For years, the LAMP stack (Linux, Apache, MySQL, PHP) has been the default gospel for developers from Oslo to Bergen. But Apache, for all its flexibility, has a weight problem.

We are seeing a shift. High-traffic portals and lean startups are trading the comfort of .htaccess for raw throughput. Enter Lighttpd (pronounced "lighty"). It promises to handle 10,000 parallel connections without eating your server's entire memory bank. But is it ready for production in a serious business environment? Let's inspect the architecture.

Apache 2.2: The Heavyweight Champion

Apache is the IBM of web servers: nobody gets fired for choosing it. It is robust, documentation is everywhere, and modules exist for literally everything. The killer feature for shared hosting and dev teams is dynamic reconfiguration via .htaccess files. You can change rewrite rules without restarting the daemon.

However, Apache's legacy architecture—specifically the Prefork MPM (Multi-Processing Module)—is its Achilles' heel on a VPS with limited RAM. Apache spawns a separate process for every connection. If you have a 512MB or 1GB VPS and a sudden traffic spike, those processes multiply until they consume all physical RAM, forcing the OS to swap to disk. That is when your site dies.

Optimizing Apache for a VPS

If you stick with Apache, you must restrain it. Do not use the default configs shipped with CentOS 6 or Debian Squeeze. They are often tuned for dedicated hardware.

<IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 3000 </IfModule>
Pro Tip: Calculate your MaxClients based on your average process size. If a generic Apache process takes 15MB and you have 512MB RAM (leaving 200MB for MySQL), set MaxClients to roughly 15-20. Setting it to the default 256 is a suicide pact for your server.

Lighttpd: The Asynchronous Challenger

Lighttpd takes a different approach. It uses an asynchronous, event-driven architecture. Instead of spawning a process per user, it handles multiple requests in a single process loop using epoll (on Linux). This means the memory footprint remains flat even under heavy load.

For serving static content—images, CSS, JavaScript—Lighttpd is objectively faster and lighter than Apache. It relies on FastCGI to talk to PHP, which decouples the web server from the application logic. This setup (Lighttpd + PHP-FPM) is becoming the secret weapon for high-performance setups.

The Lighttpd Configuration difference

Lighttpd doesn't use .htaccess. All rules go into lighttpd.conf. This improves performance because the server doesn't have to scan directories for override files on every request, but it decreases convenience.

server.modules = ( "mod_access", "mod_fastcgi", "mod_compress", "mod_rewrite" ) server.event-handler = "linux-sysepoll" server.max-fds = 2048 static-file.etags = "enable"

Head-to-Head: Latency and The "CoolVDS" Factor

Software tuning only gets you so far. The underlying metal matters. In 2012, we are seeing a massive divergence between providers offering standard SATA HDDs and those deploying Enterprise SSDs.

On a traditional HDD, Apache's process spawning causes random I/O seek latency. When the disk heads are thrashing, your Time To First Byte (TTFB) shoots up. This is where CoolVDS has drawn a line in the sand. We utilize pure SSD storage arrays in our Norwegian datacenter.

FeatureApache 2.2Lighttpd 1.4
ArchitectureProcess-based (Blocking)Event-driven (Asynchronous)
Memory UsageHigh (Scales with connections)Low (Constant)
PHP Handlingmod_php (Embedded)FastCGI (External)
ConfigurationFlexible (.htaccess)Centralized (lighttpd.conf)
Best ForDynamic apps, Shared HostingHigh concurrency, Static assets

Data Privacy & Norwegian Compliance

Latency is not the only reason to host locally. With the Norwegian Personal Data Act (Personopplysningsloven) and the Data Protection Directive strictly governing how we handle user data, keeping your server physically located in Norway simplifies compliance. Hosting outside the EEA (like in the US) introduces legal headaches regarding Safe Harbor frameworks that many CTOs prefer to avoid.

Furthermore, peering at NIX (Norwegian Internet Exchange) ensures that your Oslo-based customers get sub-10ms response times. Lighttpd serving static assets from an SSD-backed CoolVDS instance in Oslo is essentially instant for a local user.

The Verdict: Which Should You Choose?

If you are running a complex legacy application heavily dependent on .htaccess rewrite rules, stick with Apache 2.2, but tune your mpm_prefork settings aggressively. However, if you are deploying a modern framework or a high-traffic media site, Lighttpd is the superior tool for the job in 2012.

Don't let disk I/O be the bottleneck that renders your optimization useless. Experience the difference of low-latency local hosting.

Ready to benchmark your own stack? Deploy a CoolVDS SSD instance in our Oslo datacenter today.

/// TAGS

/// RELATED POSTS

Surviving the Spike: High-Performance E-commerce Hosting Architecture for 2012

Is your Magento store ready for the holiday rush? We break down the Nginx, Varnish, and SSD tuning s...

Read More →

Automate or Die: Bulletproof Remote Backups with Rsync on CentOS 6

RAID is not a backup. Don't let a typo destroy your database. Learn how to set up automated, increme...

Read More →

Nginx as a Reverse Proxy: Stop Letting Apache Kill Your Server Load

Is your LAMP stack choking on traffic? Learn how to deploy Nginx as a high-performance reverse proxy...

Read More →

Stop Guessing: Precision Server Monitoring with Munin & Nagios on CentOS 6

Is your server going down at 3 AM? Stop reactive fire-fighting. We detail the exact Nagios and Munin...

Read More →

The Sysadmin’s Guide to Bulletproof Automated Backups (2012 Edition)

RAID 10 is not a backup strategy. In this guide, we cover scripting rsync, rotating MySQL dumps, and...

Read More →

Paranoid Security: Hardening Your Linux VPS Against 2011's Threat Landscape

It's 2011 and LulzSec is on the loose. Default configurations are a death sentence. Here is the batt...

Read More →
← Back to All Posts