Charlton's Blog

The LLMN Stack: A Comparison

I figured I should make a short post about my web stack.

Published: Jun 2, 2015
Category:
Tags:

I figured I should make a short post about my web stack.

A bit of background

I prefer lightweight and fast pieces of software that sip system resources, so it’s no secret that I dearly love web servers like Lighttpd and NodeJS. Coming from a background where old, slow, and obsolete hardware was all that I had available to play around with put system optimization at the forefront of my priorities.
 
 My very first “server” of sorts was an original raspberry pi model B. I kept it in a cabinet in my room, and it was connected to my network via wi-fi. Reception was terrible, and so the website I ran on it (which was hosted by Apache) was sluggish but still just good enough that I was able to serve a 144p shockwave flash video of my principal dancing hilariously to some music, which was super funny among my peers.
 
 Eventually, I switched from Apache to Lighttpd, because I was also trying to use the pi as a media center with XBMC and a Samba server, and I needed a lighter weight web server (and besides, for completely static sites Apache is overkill).
 
 In my searching, I came across Lighttpd (I don’t know why I didn’t find Nginx first, but I wish I had, especially since Lighty v1.5 is slow in coming) and it solved all of my problems. I would later switch back to Apache when I got a slightly nicer desktop from a computer recycling plant, but I eventually returned, once again, to Lighttpd.

About the stack

So, with speed, a small footprint, and performance in mind, LLMN is extremely close to LEMP. In fact, in benchmarks, Lighttpd and Nginx are remarkably close (though Nginx is often slightly faster).
 
 Here are a few good benchmarks comparing them:
 As noted earlier, the performance of the two servers is strikingly similar. That said, for my needs (running a small site that averages around 1k requests per day), Lighttpd is perfect. It’s been rock solid, low-maintenance, and has gracefully scaled up to my needs as they have grown, and hasn’t crashed once over years and years of use. I will admit, however, that I’ve been considering switching to Nginx recently, though I dread porting my configuration files. Incidentally, that would make this a LEMN stack :P
 
 In fact, I was DDOSed several months ago, and my uplink bandwidth was saturated long before Lighttpd even began to use more than 2% CPU usage.
 
 Besides the web servers, the other major difference between these two stacks is the choice of server-side language (which, in the case of LLMN, is JavaScript instead of PHP).
 
 There are a few good reasons for this:
 
 I love JavaScript. It’s the language of the web and has absolutely soared in popularity over the past few years. It runs everywhere, from desktops and mobile devices to servers and even microcontrollers! The ability to develop and maintain applications in a single language across both the client and server is also very alluring, and simplifies the development process considerably.
 
 NodeJS, like Lighttpd, is fast, lightweight, and asynchronous. Have a look at this benchmark. Or this test.
 
 NodeJS has lots of modules, packages, and libraries available to freely use (though this is also true of PHP). There are over 153,000 packages available on npm, which is Node’s package manager.
 
 NodeJS has an enormous community. Because JavaScript runs everywhere, Node developers can get help from the entire JavaScript community, while working on a project. This portability means that help and support is extremely easy to come by. As a result, Node is great for newcomers to server-side web development.
 
 Also, these fortune 500 companies all use Node for their backend.

Conclusion

  • LLMN is fast, low-maintenance, and extremely resilient, with an incredibly small footprint.
  • NodeJS is fast, has a great community, and highly extensible with lots and lots of modules and libraries. JS as a common language on both the client and server makes web development much easier.
  • NodeJS still isn’t as widely used as PHP, which powers popular frameworks like Wordpress.
  • While Lighttpd is fantastic for static pages or as a proxy, Apache, though heavier, is generally better at interfacing with PHP and serving dynamic content. Lighttpd is also outperformed by Nginx by a hair. Compared to Nginx, Lighttpd lacks some features.

Originally published at blog.ctis.me on June 2, 2015.