[su_note note_color=”#f3f4f4″]Dear visitor, thank you for reading my blog. Target audience for this write-up are beginners looking to implement HHVM, PageSpeed or both in the most simple way. We are looking for as much automation as possible. Easyengine, which recently released version 3.1 has been used for setting up the environment. It can be used to exceed more than 40 million hits per day and also to set up a web server for your blog in less than 10 minutes.[/su_note]
There are fantastic web hosting companies which offer all of the latest technologies to their customers, for example Wpengine, Kinsta hosting and RTCamp, creator of EasyEngine. Unfortunately latest and greatest is not that easy to set up. If you like to tinker and host your own website, with the latest technologies and achieve similar result, what do you do? If you are into Linux, you install piece by piece and after a while you have a very capable web server. But it you prefer to use a tool that does everything for you, you install EasyEngine. And save some time in the process.
Easyengine 3.1 release installs HHVM, PageSpeed the easy way
If you run a VPS server to host websites, then you also look for ways to optimize it for speed and to make it more efficient. There are two new technologies that can make your website run faster and optimized for speed.
What is Google Pagespeed?
The first technology that is new to the latest version is called PageSpeed, created by Google. It’s an awesome extension for a web server (Apache and Nginx) which automatically applies best practices for web performance to pages and the assets. It can do many optimizations, currently around 40.
If you run a WordPress site, then you must have been using a caching plugin to cache website. If you want to optimize the site for Google PageSpeed insights test or YSlow, you have learned that It’s possible to minify CSS and JS files, optimize images for faster load time and so on.
You can use a separate plugin for minification like Autoptimize, service for optimizing images or you could use something like Wp Rocket which can do minification as part of the caching plugin, but you still have to optimize images.
You see, with PageSpeed, you can don’t need additional plugins as the extension does this for you. But where PageSpeed really shines is in combination with Nginx cache. Why? Because in the past it was not possible to apply optimizations easily to a Nginx cached website.
With Nginx, you have an option to cache website so that requests don’t reach WordPress most of the times. Using this technique you can greatly improve your website speed and also number of concurrent users on your website. Part of the problem why Nginx or Varnish can do wonders is PHP which has to compile a website every time it receives a request.
WordPress caching plugin partly solves this problem, but it is still slower than serving static web pages directly from a web server cache. If you enable Nginx caching out of the box, all optimizations like Minification made by plug-in don’t affect the cache as it is built by the web server. This is where PageSpeed falls beautifully in. It taps in to the web server and provides ability to optimize website based on the best practices. For example, you can minify, combine, optimize images, convert images to WebP format, it has more than 40 modules which you can enable.
What is HHVM?
Facebook started a revolution with HHVM (Facebook version of PHP language). They were able to create a version that is mostly compatible with the standard PHP. With slight modifications applications can run without any problems on HHVM but much faster. In some cases up to 10x faster. WordPress is compatible with HHVM from version 3.9. With version 4.0, compatibility was improved even further. Like I said before, HHVM’s main advantage is speed.
Where this really matters is the back-end which is not cached at all. Another example where you need additional speed is Woo-commerce and similar e-commerce extensions where you can really improve experience for your customers.
You can notice a boost on entire PHP enabed website as well. If you replace PHP with HHVM, you will notice speed improvements on the page load time as well.
I really wanted to test HHVM. All the reviews that I read made me drool. With the latest version of Easyengine, I just couldn’t resist. I created a new droplet on DigitalOcean, installed latest version of EasyEngine, created a website with HHVM support and moved itsmdaily over. As I was so impatient I immediately ran Pingdom. Wow, just wow, load time was only 852ms.
Ok, what about my current set up? I moved DNS back to my primary droplet, fired up Pingdom:
Oh no, what a difference. I know I broke optimizations a bit recently when I was playing with site design, but reducing a second in load time…. Amazing.
How does the procedure to set up a HHVM website looks like? Once you install EE, just type: ee site create example.com –wp –hhvm
[su_note note_color=”#f3f4f4″]root@dc5:/etc/ee# ee site create itsmdaily.com –wp –hhvm
Adding repository for MySQL, please wait…
Adding repository for NGINX, please wait…
Adding repository for PHP, please wait…
Adding repository for HHVM, please wait…
Updating apt-cache, please wait…
Installing packages, please wait…
Downloading WP-CLI [Done]
Reload : postfix [OK]
Reload : nginx [OK]
Reload : php5-fpm [OK]
Restart : hhvm [OK]
Reload : mysql [OK]
Setting up NGINX configuration [Done]
Setting up webroot [Done]
Downloading WordPress [Done]
Setting up database [Done]
Installing plugin nginx-helper, please wait…
Reload : nginx [OK]
HTTP Auth User Name: easyengine
HTTP Auth Password : ttrght
WordPress admin user : user
WordPress admin user password : password
Successfully created site https://itsmdaily.com [/su_note]
If you already use EE you have to upgrade first to te latest version, type:
[su_note note_color=”#f3f4f4″]ee update[/su_note]
you can switch your site to HHVM by entering:
[su_note note_color=”#f3f4f4″]ee site update example.com –wp –hhvm[/su_note]
To disable HHVM you can enter:
To set up a site with PageSpeed
[su_note note_color=”#f3f4f4″]ee site create example.com –wp –pagespeed[/su_note]
You can also mix and match Nginx cache, HHVM and PageSpeed:
[su_note note_color=”#f3f4f4″]ee site create example.com –wpfc –hhvm –pagespeed[/su_note]
While HHVM is used in a production, it still has some problems. Sometimes it may fail. In that case EasyEngine provides a way for HHVM to fall back to PHP when it fails so that users don’t experience a broken website.
What I like with EasyEngine is that they move on with technologies that can improve your website speed. Is latest version perfect? Almost.
What’s missing? I would really, really love if it had an easy way to create a user that would be a part of www-data group for example easyengine user which could connect to SFTP and copy files without borking permissions. Another feature I look forward is a firewall that would be created automatically with ee installation. EE started as an opensource project to make hard things easy.
It succeeded and is I think the easiest way to set up a HHVM enabled website. I heard that it will turn to a commercial project which is fine. I just hope that lust for money doesn’t destroy amazing project which can enable anyone to set up more than decent web server.