New performance improvements of the web hosting environment
We, as a web hosting provider that aims to be innovative and customer-oriented, are committed to constantly imrpove and enhance our web hosting environment, so we can provide our customers with better performance and high reliability. As you know, we are running a custom built cloud platform, based on BSD's ZFS filesystem. Our cloud hosting environment surpasses in performance and reliability any shared hosting environment, where the user accounts are stacked on a single shared cPanel server and there is a master billing and invoicing server. Our cloud hosting environment is like a living organism, with automatic load balancing so no single server ever reaches a critical load and if a single component of the environment is impacted by a mechanical failure or is under attack or heavy load, the network and the rest of the hosting environment can remain operational. You can readm more about how our cloud hosting environment work in this blog post: Our custom built cloud web hosting platform with Hepsia explained. Today we would like to introduce something which we recently implemented to our cloud hosting, semi-dedicated hosting, openVZ VPS hosting and Virtuozzo VPS hosting that adds additional improvement of the environment, further improving it's performance.
Introducing haveged daemon
The haveged daemon is a piece of software designed to do just one particular job – fill up the server’s entropy pool. With a full entropy pool, applications that use random data will be able to perform faster. What does it mean for your websites and web applications? Well if you have a piece of software that uses random data (like an installed SSL certificate, encrypted databases, a "random dice roll" app, etc.), it will work much, much faster.
What is an entropy pool?
The entropy pool is the place on a Linux server where all random data is stored. This data is used by almost every server app that needs to use random numbers. It’s collected from hardware interrupts triggered by mice, keyboards, disk drives or I/O devices. And web hosting servers usually don't have keyboards nor mice, so the entropy pool receives data from fewer sources.
How does the haveged daemon fill the hosting server's entropy pool?
The haveged daemon sends small CPU requests and then collects the different responses and uses them to fill up the entropy pool. Our tests show that servers running the haveged daemon fill up the pool almost instantly.
How will all of that affect the hosting server’s performance and my websites?
On every Linux server there are two primary random data feeding sources – /dev/random and /dev/urandom. The first one waits until the entropy pool is full and then gathers the random data. It’s the default ‘go-to’ for all apps looking for random numbers. The problem is that it works only when the pool is sufficiently full. In comparison, /dev/urandom works even when the pool is nearly empty, but it returns a lot less random data.
A random data pool that is low on entropy can severely affect the security of the client-server communication, lowering the chance that your data will remain safe and unbroken from cryptanalysis.
In stark contrast, an entropy pool that fills up fast will increase not only the security of the client-server communication, but also its speed.
Here is a simple test scenario – accessing encrypted data in a MySQL database using the mcrypt PHP extension.
If you want to store encrypted data in a database, the mcrypt PHP extension has to encrypt this data first. To do that, it uses random data from the entropy pool. With a fuller pool, the encryption will be better and the process will be completed faster, resulting in faster database queries. The same applies to the reverse process – accessing already encrypted information.
Our tests show that the same database works about 10 times faster when the server is running the haveged daemon.
The best part is that there are no code changes or data validation modifications required. It works right away to all existing apps and websites, therefore your websites and web apps are already performing faster.