Comparing the throughput of web application frameworks
Referring to cakephper’s articles, I also tried to compare the throughput of the web application frameworks, which are CakePHP, Codeigniter, Ruby on Rails and TreeFrog Framework.
The throughput of retrieving and displaying of one record in RDB was measured.
In this article, "faster" means that the throughput of a framework is higher.
| Server: Core2 Duo E4500 @ 2.20GHz / 2GB Memory / SATA HDD / 1Gbps Ethernet
OS: Ubuntu 12.04 (32bit)
PHP 5.3.10 with APC3.1.7
Schema of ‘posts’ table
|CREATE TABLE IF NOT EXISTS `posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created` datetime DEFAULT NULL,
`modified` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Beforehand, ten records that contained Japanese’s text were inserted into RDB.
Because I want to measure the speeds of frameworks purely, the number of the records in RDB was reduced to 10 so that RDB processing does not become a bottleneck.
- TreeFrog Framework 1.0
- CakePHP 2.2.0
- Rails 3.2.6 (Apache+Passenger+Asset Pipeline ON)
Using the measuring tool Siege, I measured how many times it can process for 3 seconds by simultaneous 10 connections from a remote machine. Measuring is carried out about 10 times every frameworks, and the average of the top three of them was enumerated.
| $ siege -b -c 10 -t 3S http://192.168.x.x/controller/path
FYI, Measuring the code written by Plain PHP, the result was 1261 trans/sec. Amazing!
I found simplistic PHP code is awfully fast.
Result – List
The detailed results are here :
Result – Graph
The results are as follows. A framework that has higher value is faster.
The app codes of CakePHP and Codeigniter are here.
TreeFrog Framework : https://docs.google.com/open?id=0B1pTorSDNQjbNldxT1NjbEs4VzQ
make commands :
$ qmake "CONFIG+=release" -recursive -spec linux-g++
About memory usage :
Under high loads, the memory usage of TreeFrog Framework seems to be the lowest of them.
Top command screen on high loads of TreeFrog Framework: