PHP / Symfony 1.2 with Propel test and benchmark


Initialize the mysql database from a previous dump as I did earlier.

Install PHP and Symfony 1.2

Unlike previous test subjects php doesn’t come with the default linux install. So first of all we need some php package. Because php doesn’t have such tool like Perl’s CPAN or Python’s easy_intall we’re going to install everything with yum. (This is not completely true. PHP has PEAR and Pecl too for installing third party libraries but not for all php modules)

In the default 6.2 CentOS packages we don’t have php-fpm which we will neeed if we want to be objective and use nginx webserver for serving php test sites. One way to do this is we have to find a third party repository where the neccecary packages are maintained. The other way it to compile php from source. I like this way better because php package depends on httpd (apache) package which I really don’t need at all. But feel free to choose whatever options you like.

Compile from source:

First steps

Set up php-fpm and nginx and now we can see our default symfony front page.

Import schema from model

This is very easy to do after we set the config/databases.yml and config/propel.ini correctly. Just put these in command line and symfony will generate all the configs and models you will need.

Start our first application

We need an action ( controller ) and the regarding templates to create the pages for the test.

The action class:

Really simple, really easy.


Nginx and FastCGI

I used fastcgi process manager (phpFPM) to do this. This is able to start new processes when it’s needed. Something similar as apache prefork model. The sample configuration for nginx can be downloaded from either nginx’s or symfony’s website.


The results was more then below expected. And the box was overloaded already at 20 concurrent ab threads. The average process consumed 2.2% of memory which means around 13MB. That sounds really good until you find out that php-fpm will spawn a new process for almost every concurrent thread. After about 40 process the memory became full and the box started to swap. Of course I can limit the number of max children in php-fpm.conf but if I did this the number of failing requests increased and the request/sec rate dropped down significantly. At maximum 20 children the load was 13,27 and at maximum 50 children the load went up to 21,59.

Index Show
AB 5 conc 24,29 23,77
AB 20 conc 23,81 23,6
AB 50 conc 23,75 23,67
Memory usage 2,20% per thread 2,20% per thread
CPU usage 100,00% 100,00%

 Summary »


You might like these too

PERL / Catalyst test and benchmark Initializing First of all I have created the environment for the test. On the previously cloned machine the database has been imported and started. T...
Framework comparison summary To be able to size up an objective summing image I started to build an e-commerce website in all frameworks on the same model. These are my experience...
Framework comparison (PHP, PERL, Python) My first "program" was a BASIC script on Commode 64. It was able to print some text on the screen twenty times. The text was "Hello world". I copied i...