Supercharging Kompiler.no

Hello there gentle-people. I am one of two R&D board members at Kompiler.no, and in this post I want to give a brief look into the stack driving the Kompiler.no site. If you are into web stacks this might just be the post for you!

If you have been following kompiler.no for a while you might remember our old Wordpress blog. Unfortunately the Way Back Machine does not seem to have saved our css. But it gives you an idea of the content we used to have. Our site used to run of the traditional LAMP (Linux Apache MySQL PHP) stack. But no more. Say hello to the LNSJ (Linux Nginx SQLite JavaScript) stack, in my head pronounced like lunch.

At this point you might ask yourself why we would change the stack. Why change something if it just works ™. I believe one of Kompiler's core missions should be that of providing a learning environment. One should not be afraid of testing out the new and shiny, so here is kompiler.no in all its new and shiny bravado.

The Apache HTTP server software has driven a lot of web servers for a long time. It is however not generally asynchronous and will spawn new threads for every request. Not really a problem for a site the scale of kompiler.no, but no less a less than optimal design. Further I feel configuration of Apache leaves a bit to be desired. Nginx seems light weight in comparison, provides single-threaded (you can have multiple workers) asynchronous serving of resources, and configuration is generally a breeze.

PHP started out as a little scripting language used to make small sites more dynamic. It was great for the hobbyist, but then turned into something more. It has turned into some spawn of object oriented script language with weird automatic type casting, multiple functions that do the same thing, but some of them being deprecated for security reasons, and a somewhat sketchy security history. So in comes Node.js a server-side JavaScript engine that provides a reasonably stable API, good library support, and exceptional performance via asynchronous, single-threaded HTTP request handling. In effect Node.js is pretty darn cool for web application development.

I'm not going to go into any details on the database choice. SQLite is probably the least overkill component in our stack and is good enough to drive this blog. On top of it all we use the Ghost Blog software. It is written in JavaScript to run on Node.js, and uses Ember.js (a reactive JavaScript front-end library) for the admin interface. In summary it is quite a nice piece of software and completely open source. If you are looking for a new blogging platform you might want to try Ghost. Beware though, it is still in early stages of development.

Software aside, you might wonder what kind of hardware we're running on. With the risk of triggering the buttcloud plugin in your browser I can inform you that we host our Kompiler.no server in the cloud. It is an SSD backed server with ample memory (1GB) provided by DigitalOcean. But all traffic is routed through Cloudflare to minimize the response time on our servers.

In conclusion I think we can safely say that the stack is way overkill for something the size of Kompiler.no. But were is the fun in a shared LAMP server with php and MySQL backed applications? I see none, and that is why we now enjoy the LNSJ-stack on a dedicated VPS.