Performance: Play Framework vs. CodeIgniter vs. WordPress
In December 2011 I decided to give Play! Framework a go, and what better place to start than right here on my blog. A totally non mission critical application that I can just have fun with and figure out how play works. I was so impressed with play but I already wrote an article on that.
Having had previous versions of my blog with pretty much the exact same data structure and queries being pulled out, all running on MySQL, I had three copies of my blog sitting on my VPS:
- My Wordpress site from 2010
- My CodeIgniter blog from 2011
- This blog your reading running on Play!
I would love to have the time to write my blog in a few other languages and frameworks to put into this benchmark, especially Ruby on Rails and ASP.net MVC 3, though finding the time for that would be a nightmare!
Test specs
Hardware
All three sites are running on a cloud VPS provided by BigWetFish, basic specs and system setup detailed below:
- Two dedicated Xeon cores
- 2GB dedicated ram
- 50 GB SAN storage
- Ubuntu 10.04 O/S
- Apache 2.2 web server
- Based in a datacenter in London
Test system
I have been using a free account on blitz.io to send concurrent users to the sites over a measured period of time, this will test the throughput of the sites. Here are the exact parameters of the tests being run:
- 1-250 concurrent users over a 60 second window
- All users coming from Ireland
- Timeout of 1 second.
I have set the timeout to 1 second as I think any page taking more than 1 second to load is extremely slow.
Results
Wordpress
It gets banded about a lot in the developer industry that wordpress is terrible when it comes to performance, with version 3 of their blogging platform they noted that one of the major changes was performance, they have really worked hard to strip things back.
I don’t think their performance tuning worked that well. Wordpress crashed apache on my server after 35 concurrent users, managing a shocking 85 successful hits and only lasting 8.54seconds into the test.
Wordpress can handle around 230,000 hits per day on this server.
CodeIgniter
I have been using CodeIgniter for almost 2 years now, writing a lot of web applications, it seems to fair very well in any performance tests I have seen against other PHP frameworks, usually landing in the top 3.
CodeIgniter at least managed to make it the whole way through the test and didn’t push apache to the breaking point either. Codeigniter managed 1,450 hits over the 60 seconds and made it up to 121 concurrent users without any timeouts.
Once the number of users went above 121 however, timeouts started to occur, in fact 66.1% of all hits in the test where timeouts.
CodeIgniter can handle around 3.1 million hits per day on this server.
Play Framework
I know play framework is certainly not using PHP, compiled Java is obviously going to be faster, but I think this test is still certainly valid to show how much faster Play can be for a small application with simple data structures, and how that would translate into being exponentially faster for large applications with complex data structures. Play made it all the way to 250 concurrent users without breaking a sweat, the maximum response time at 250 users was 558ms, almost half of what our timeout was set to, so I would expect play to be able to serve over 400 concurrent users on this server without timing out. Play managed 5,944 users over the 60 seconds and can handle around 8.2 million hits per day on this server.
Summary
If you’re a developer and thinking of writing a blog, I would suggest not to use wordpress, especially if you expect to get a lot of visitors!
With CodeIgniter, you’ll certainly be able to handle a lot more traffic than wordpress, but if performance is key there is no reason not to look at something like Play! Framework.
Your development time will rapidly increase especially if you use JPA and Hibernate persistence with play to automatically map your objects straight to your database, and performance wise I believe play can handle around 4 times the throughput on a simple application like this, possibly even more on a larger more complex web app.


