Here are some special HHVM WordPress (Nginx Ubuntu Server) Tweaks for Page Speed optimization, Compatibility of WordPress Themes and Plugins. PHP is itself quite pathetic performer and together with MySQL and WordPress uses peculiar outdated database in more odd way. To run a website with WordPress with 5K+ posts is not quite cost effective. Apache2 is not actually very bad web software, Apache itself has own Free Software License with huge documentation, Nginx entered for less need of complicated backend configuration for optimal page speed at somewhat budget. Additionally, Nginx plays better for websites with HSTS.
HHVM WordPress (Nginx Ubuntu Server) Tweaks : Basics
Ultimately, all need to use a Cache plugin, even after huge tweak on the part of MySQL. So, at minimum; we are using :
01 x 8GB server (front end web server) plus 01 x 4GB server (Application / database server) for a HSTS website with 100K hits per month.
The need of higher RAM of front end web server is to increase the number of virtual cores to quickly write the HTML files after flashing the W3TC cache (all cache). Most Cloud Computing IaaS providers has number of cores for 2GB and 4GB instances except IBM / Softlayer. For a blog, the cost is sadly too high. HHVM actually does not really decrease any running cost, compared to PHP5-FPM. But it significantly a better compilation than default PHP5-FPM.
The developers of WordPress, including Matt Mullenweg actually fight with handing traffic load. We have not spend enough time with the new version of HHVM, but it is apparently better than native PHP5-FPM. With our previously linked guide, which is minimally optimized, you will get a speed like this :
# Hosting is HP Cloud
PHP-FPM actually win in the real life high concurrency test for WordPress.
Some WordPress Plugins and Theme Framework can fail, we need some basic tweaks on WordPress part.
Advantages of HHVM can be summarized as :
- Has Hacks
- Native JIT Compilation Support
- FastCGI Support
- Most PHP Frameworks We Ever Need For WordPress Actually Works
If you install HHVM-Nginx-WordPress in our way, switching back to Nginx-PHP5-FPM is just commenting two lines, uncommenting one line and running
service nginx reload command. In the
/etc/nginx/sites-available/default you need to comment out the include hhvm.conf line and PHP to listen to port 9000. Uncommenting is for listening to PHP UNIX socket and reload Nginx – thats enough to switching back to Nginx-PHP5-FPM. Yeah, both are actually quite closer.
HHVM WordPress (Nginx Ubuntu Server) Tweaks
Basic cheat sheet is to edit this file :
wp-db.php has a bug with HipHop for WordPress. WordPress (pseudo) Gurus know it, but kept it :
object, if written in various ways, can have 3 variations. So, for the newest version; you will get something like :
define( 'OBJECT', 'OBJECT' );
define( 'object', 'OBJECT' );
It is nearly within first few blocks, you can find by simple scrolling. We comment out in PHP in this way :
//define( 'OBJECT', 'OBJECT' );
//define( 'object', 'OBJECT' );
And add this block :
Yes, you can add only
define('Object', 'OBJECT');, but; you can later forget what you have changed. This will have to be done anytime you update WordPress. Sad. If you have JQuery or TinyMCE (where we write the post – post editor) giving error, you will add this at the end of
wp-content directory :
sudo chmod 775 /check/path/to/your/wp-content -R
Cache Plugin, Nginx and HHVM all probably start
thinking a bit more if only we keep with
root:www-data CHOWN value. It makes the Cache writing faster with huge number posts. A bit wider open value probably decreases the needed amount of logical work by the virtual processor. You can test to check with
webpagetest.org. Insane logic but works. Basically – Nginx, HHVM, MySQL are not written for WordPress, if WordPress developers do not think to freshly write for the database, neither interested for changing from PHP to a some practical language like Ruby or Python, these sadness will continue.
Thats why for smaller blogs, OctoPress or Jekyll are better. There are Python based web softwares too, which are kind of closer to WordPress.
WordPress beats at user Interface – everyone can use. But, practically changing from WordPress site with 5K posts to kind of closer to WordPress, closer to Django is not practical, so these hundreds of tweaks will continue until a stable option arrives. We are actually serving HTML pages with the cache plugins but obviously if the PHP scripts are NOT executed, you will get 500 server error or 502 server error. 25% or may be lesser part for a cached pageHp part at fontend. Non cached page will be slower as expected, PHP or PHP like, is not really Python. If Facebook knew how to
automatically change PHP made material to Python, they would not develop HHVM! So, if we keep an eye on Facebook, we can speed up WordPress. Facebook is C, D, P -> C++, D Language and PHP. That PHP went to HHVM, because they were fighting with increasing capability of their Datacenter! But, essentially Google never needed to change the way. Blogger is written in Python and 100% closed source software.