rwasa + HHVM + WordPress
Yes, as exotic as it ever gets.
Rapid Web Application Server in Assembler is a webserver written entirely in assembly language. It comes with the required set of features to serve static files for WordPress and proxy PHP requests via FastCGI to HHVM. But what’s more impressive is its performance, especially in SSL configurations. It’s set to beat the likes of superstars like nginx and lighttpd.
Building rwasa is quite simple, and is often not required, since the latest HeavyThing tar file (this contains rwasa) has precompiled binaries of it. But in case you want to build it you’ll need to use the Flat Assembler (
fasm -m 262144 rwasa.asm && ld -o rwasa.o rwasa, takes about 4 seconds on my 8G/4-core machine).
I installed version 1.01 of the HeavyThing library.
The Hip Hop Virtual Machine compiles PHP code down to a hightly optimized intermediate bytecode binary that runs blazingly fast.
I installed version 3.5.0 of HHVM via my package manager (pacman on Arch).
Our last component, the latest stable version of WordPress right now, which is 4.1.
All together now…
With HHVM running on the default localhost:9000 port, rwasa was launched with:
./rwasa -cpu 1 -foreground -bind 9999 -sandbox /tmp/wordpress/ -runas soulseekah -fastcgi .php 127.0.0.1:9000 -indexfiles index.php. Installation went fine and I was presented with:
Bam! Initial page loads are quite slow, but are lighting fast afterwards (HHVM bytecode cache). Static file downloads seem faster out of the box as well, compared to my default nginx configuration.
While HHVM should work fine with WordPress (and this is awesome), rwasa is probably highly experimental and should not be put into production systems without consulting its author first.
rwasa also does not support rewriting out of the box, so without implementing some more assembly to mimic nginx’s
try_files, for example, for a fallback to index.php on files that don’t exist, pretty permalinks won’t work.
/index.php/ prefixed permalinks links like
/index.php/%postname%/ do still work. Anyone care to write some assembly (I might actually try it this weekend)?
This was fun. If I ever stumble into an environment where static serving over SSL is a bottlneck I’ll surely look back at rwasa (after squeezing every last bit out of nginx), I’m sure by then rwasa is packed with more juice and has passed the test of time. As for HHVM – rocks as always, but still eagerly waiting for PHPNG improvements to land.