Tuesday, May 24, 2011

Lightspeed-PHP performance and scaling tests

Lightspeed-php performance
The still under heavy development Lightspeed-PHP has been designed from ground up to be lightweight, easily understandable and extendable,  full-featured yet web-oriented high performance PHP framework that plays well with the Hiphop PHP to C++ code transformer-compiler and is well suitable for distributed deployments.

It's now maturing and mostly ready for prime-time, taking on it's first projects. There is thorough auto-generated documentation from the comments but proper manual will be created once it has driven an actual project and become stable enough.

A sample application was created on it - a simple blog where people can register and add posts. This was used for the performance and scaling testing and it uses the Cassandra-driven sharding architecture discussed so far.

The more code and heavy-lifting there is in the code, the more Hiphop shines. Below is a graph of the example application front-page benchmark, comparing vanilla-PHP with Hiphop-driven.



As can be seen, Hiphop performs nearly ten times better at higher loads. Similarly the 90% render times show greatly improved performance.



As the frontpage is very lightweight, it's not a good indication of the real performance. To test this, the system simulated registering a used that required several roundtrips to Cassandra, MySQL shard and Memcached. Graphs of requests per second and 90% time for this comparison come below.



Again, the results given by Hiphop-PHP driven application are impressive, translating into great savings on hardware of heavily-loaded systems.

Scaling testing
To test scaling, the cluster in the Amazon Cloud was doubled so now it contained two of everything - webservers, Cassandra and Memcache instances and RDS databases. With a testing machine and load-balancer, this basically meant ten machines. Graphs for the results follow.



As can be seen, the requests-per-second almost doubled while the 90% time lowered too. As neither of them alone is sufficient indication for the performance comparison, I devised a method that I called performance index that is simply the division of requests-per-second by the 90% time as this gives a bigger index for higher req/s and lower 90% time that are both valued qualities. Putting this data on a graph gives the following:



As the req/s stat almost doubled and the 90% time also decreased, the increase of performance seems to be actual higher than doubling, ~350% to be precise. I'm not entirely sure what are the implication of this but it seems great.

This testing has shown the good performance of Lightspeed-PHP framework, especially when using the Hiphop-PHP transformer. It also displayed that the Cassandra-driven sharding architecture works and should indeed provide high and linear scalability.

Detailed analysis
This test is more thoroughly explained with all the numbers in a PDF document that you can download here.

No comments:

Post a Comment