I want to benchmark PHP vs Pylons. I want my comparison of both to be as even as possible, so here is what I came up with:
- PHP 5.1.6 with APC, using a smarty template connecting to a MySQL database
- Python 2.6.1, using Pylons with a mako template connecting the the same MySQL database
Is there anything that I should change in that setup to make it a more fair comparison?
I'm going to run it on a spare server that has almost no activity, 2G of ram and 4 cores.
Any suggestions of how I should or shouldn't benchmark them? I plan on using ab to do the actual benchmarking.
Related
- Which is faster, python webpages or php webpages?
If you're not using an ORM in PHP you should not use the SQLAlchemy ORM or SQL-Expression language either but use raw SQL commands. If you're using APC you should make sure that Python has write privileges to the folder your application is in, or that the .py files are precompiled.
Also if you're using the smarty cache consider enabling the Mako cache as well for fairness sake.
However there is a catch: the Python MySQL adapter is incredible bad. For the database connections you will probably notice either slow performance (if SQLAlchemy performs the unicode decoding for itself) or it leaks memory (if the MySQL adapter does that).
Both issues you don't have with PHP because there is no unicode support. So for total fairness you would have to disable unicode in the database connection (which however is an incredible bad idea).
So: there doesn't seem to be a fair way to compare PHP and Pylons :)