phpBB: Creating communities twice as fast
With all those improvements that we have made to Phalanger v2.0, I was very curious about its performance. Many people suspected us for cheating when we claimed that Phalanger v1.0 can run common web applications twice as fast than if the PHP interpreter is
used. That's why I'm going to publish this article which explains all steps involved in my benchmarking rather than just the results. The procedure described here should be easily reproducible and I encourage you to try it yourself, maybe with different
configuration - web server or database - and share your results. The web application of my choice is phpBB, because it is fairly widespread (chances are you have come across it on the Internet) and it is easy to install so even I can do it :-)
I'd like to compare the latest PHP without any accelerators or encoders with Phalanger v1.0 (Final) and the latest Phalanger v2.0 (09-01-2006 Nightly at the time of writing). Obviously PHP is our rival but why do I include Phalanger v1.0? Unlike v2.0, the
first version is no longer under development and we consider it quite stable. The Phalanger core has been heavily reworked in v2.0 and the impact on performance is still unknown. Including v1.0 should help us reveal potential issues. In another words, if v2.0
turns out to be slower than v1.0, then we screwed it up.
- My laptop – Pentium M Dothan 1.8 GHz, 1.5 GB RAM, Windows XP Pro SP2, IIS 5.1, .NET Framework v1.1.4322 and v2.0.50727
It would be better to use a real server system, but this is the fastest machine that I currently have.
Downloaded from http://www.php.net/
v1.0 downloaded from http://www.php-compiler.net/
, v2.0 from
. In addition, I used the MySQL managed extension, which is available on CodePlex as a
I already had version 4.1.11 installed so I decided to get along without upgrading. Otherwise
would be the place to go.
Go to http://www.phpbb.com/
and grab the latest version. Mine is 2.0.21.
- Web Application Stress Tool
We need something to measure the performance. WAST looks a little obsolete but I quite like it. It can be downloaded from
Install PHP and both Phalangers. Don't forget the MySQL managed extension for Phalanger v2.0. Unpack the phpBB archive to a directory of your choice, retaining the subdirectory structure. Now configure IIS. I decided to create three virtual directories
, and /phpBB
Phalanger2 that will all point the same physical directory where phpBB has been unpacked. They will only differ in the handler mapping for
Go to the IIS snap-in in Computer Management, and add a new virtual directory to a web site. Make sure you check the
Execute (such as ISAPI applications or CGI)
checkbox. Now go to the properties dialog and add
to the list of default documents on the Documents
tab. On the
tab click Configuration
and add a new mapping on the
tab of the Application Configuration
dialog that will pop up. Enter the following:
- if this is the PHP virtual directory, enter full path to php5isapi.dll
- if this is the Phalanger v1.0 virtual directory, enter full path to aspnet
isapi.dll, which is located in $WINDIR$\Microsoft.NET\Framework\v1.1.4322_
- if this is the Phalanger v2.0 virtual directory, enter full path to aspnet
isapi.dll, which is located in $WINDIR$\Microsoft.NET\Framework\v2.0.50727_
Close and save everything. Now IIS is properly configured but we still need to configure PHP and Phalangers.
Copy and rename php.ini-dist
and make the following modifications:
- set extension dir to full path to the ext_ subdirectory in the PHP installation
- enable (i.e. uncomment) the php mysql.dll_ extension
Phalanger does not use php.ini
. Instead, you'll need to create Web.config
file in the directory where you've unpacked phpBB. Use
for v1.0 and
for v2.0 (do not forget to rename them to Web.config
Set up DB
Make sure the database server is running and create a database named, say, phpBB. I just went to the
MySQL Command Line Client
and typed CREATE DATABASE phpBB;
Set up phpBB
Make the config.php
file writable for everyone (it is located in the phpBB root directory). Point your browser to either
Phalanger2. All three URLs should work at this point. Just remember that both versions of Phalanger use the same name
Web.config_ for their configuration file so make sure you the correct one is in place. Follow the instructions to finish the phpBB installation.
I added one topic to the forum that was created automatically by phpBB during installation. So now I had one user (admin) and one forum with two topic, one post each. A typical visitor will probably come to the main page, then to the forum page, check out both
topic, go to member list, pick the one user present there, and find all posts by this user. My stress script therefore looks like this (the Phalanger v2.0 version):
I had Web Application Stress Tool issue these localhost HTTP requests in sequence by one thread for 60 seconds with a 15 second warm-up. I noticed that regardless of the PHP-crunching engine used, there was a serious disk activity going on and the CPU load
was not at 100%. Although all these requests are seemingly "read-only", phpBB keeps information about recently active users etc. so there are probably some updates to the DB. The reason why MySQL performs such a huge amount of blocking I/O is not
known to me. Anyway, I decided to compensate by increasing the number of threads that issue requests simultaneously. At a certain number of threads (10 was my limit due to the IIS 5.1 restriction) the CPU looked saturated. It is always a good idea to perform
such a concurrency test to check whether there is not too much locking (performance would degrade) or too little locking (the server would eventually crash) :-)
The following graph shows the results of my benchmarking.
Horizontal axis denotes the number of threads used. Vertical axis denotes the number of requests processed by all threads in one second (on average). PHP was able to deliver a maximum performance of
requests per second when 8 client threads were used. Phalanger v1.0 had its peak also at 8 client threads but the performance was much higher -
requests per second. And the winner is Phalanger v2.0 with its 13,09
requests per second at 4 client threads.
This particular benchmark has shown that Phalanger v2.0 is almost twice as fast when compared to PHP 5.1.6. However, keep in mind that it was not only the PHP-crunching that ran on the machine during the benchmark. The database server and IIS were also under
heavy load, and WAST does not run for free neither. Therefore the time consumed by Phalanger is likely to have been less than 50% of the time needed by PHP.