Despite a successful mornings work my afternoon did not go to plan. I began to run tests against the products page to list products by category. The results of this test leaned in the favour of PHP although I didn’t run them with more than one client.
This is slightly disturbing as I can see no good reason why PHP is outperforming its competitors all of a sudden. The one small possibility that I see is that it is only doing one trip to the database server rather than two which is normally done with a prepare operation.
Another thing I noticed was that in this particular test series the minimum value never changed. This was easily fixed once I found that a hardcoded value was interfering with this particular return value.
In attempting to understand why PHP was suddenly doing well I also ran the MySQL based variant of the page. What I noticed is that it was a lot faster. At first I concluded that it is due to MySQL using foreign key indexes but on closer inspection I found that SQL Server is also using an index on that particular foreign key.
Overall I am left at a loss as to why PHP would do better. One theory is that it performs better when the inputs change rather than when the page returned is the same each time – this could indicate that the other two are doing query caching. This theory is I think invalidated by the fact that the Purchase page is faster in ASP.NET and JSP.
I seem to also be running up against issues of database performance and tuning and will have to determine where to draw the line.