Product Page Problems

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.

Published in: on September 23, 2009 at 6:04 pm  Leave a Comment  

Data Attachment Glitch

Upon inspecting the data in the table at the end of the day I noticed that all of the data was the same.  This should not affect my results in any way since the data is contrived but I would prefer to better simulate reality where possible.

The glitch is caused by the fact that I designed two subsystems of my test application separately without taking the other into account.  To fix it will be as simple as altering the counter behaviour.  I will need to be careful however not to influence the timer behaviour at all.

Published in: on September 15, 2009 at 4:51 pm  Leave a Comment  

Data Access Library

My initial results indicate that my data access library has a detrimental effect on the PHP implementation of my prototype.  As are result all further tests will be carried out without the benefit of such libraries even though the code is increased.

I will need to look into whether it’s just that library or classes in general that cause PHP to perform badly.

Published in: on September 4, 2009 at 3:46 pm  Leave a Comment  

Another Anomaly

An obvious trend in the values captured during my test process is that they are always bimodal.  This is slightly worrying because I am totally unsure what is causing this variation.  It may be something to do with the timer itself, .NET underlying components or may in fact be something inherent in the webserver behavior.  Whatever the case it merits some investigation.

Published in: on September 1, 2009 at 8:05 pm  Leave a Comment  

Anomalous Behaviour

In carrying out my tests today I encountered two behaviours that I am at a loss to explain.  Firstly Tomcat gradually increases the amount of memory that it is using and apparently increases in performance once it reaches a stable quantity at 128MB.

The second anomaly is that if my test fails if it runs for more than 120 seconds with two clients.  I cannot think what would cause this.  The server ceases to process anything and eventually the client apps output an empty error.log.  Without an error message it is very difficult to determine the cause of the error.

The former anomaly is unsolved.  I have since seen Tomcat reach up to 500MB of memory.  This aside Tomcat is otherwise working fine.

The latter anomaly is however easily explained.  Firstly I had an error in my error reporting code which is why no error was reported.  Even when the error is reported an HTTP 500 was all that was there.  What explained the anomaly is that with connection pooling turned on it didn’t happen anymore.  I therefore assume that MySQL was running out of ports to connect on and thus causing the pages to fail.

Published in: on August 25, 2009 at 7:38 am  Leave a Comment  

Language Differences

While it is easy to achieve the same functionality in PHP, JSP and ASP.NET it is somewhat more difficult to achieve that functionality in the same way.  For example PHP allows you to close the connection once you have retrieved the result pointer.  ASP.NET on the other hand does not.  Therefore I had to add an extra class in .NET to encapsulate the reader and connection objects and allow them to be closed when I have finished with them.

An additional problem that I am facing is that ASP.NET has a fundamentally different architecture from JSP and PHP.  ASP.NET properly isolates its code from its presentation and implements an OO abstraction layer.  The nearest I can make it comparable is by using string variables in the presentation file and placing HTML into them in my code.

I haven’t yet done a whole lot of coding in JSP but I expect there will be similar difficulties in creating a comparable application.

Published in: on August 21, 2009 at 2:20 am  Leave a Comment  

Tomcat and Connection: Close

As I attempted to establish some baseline (control) results my test timer encountered errors.  After including appropriate error logging into the code I determined the error to be socket related and specific to Tomcat.  After some research I found that Tomcat puts sockets into a state called TIME_WAIT rather than closing the altogether.  I failed to find a way to prevent this from happening.

Since I cannot find a way to reconfigure Tomcat I have determined that the best course of action is to use Connection: Keep-Alive so that only a single socket is opened with the server.  Unfortunately this does not fully simulate real life in which many independent clients open a socket to the server.  Because the target of my project is essentially page load time this should not influence my results so long as the same parameter is used for all testing.

Published in: on August 19, 2009 at 9:44 pm  Leave a Comment  

First request is slower

In writing a program which generates and times requests/responses I have noticed that the first request is always slower.  To be honest I can no longer think of anything to account for this except perhaps web servers implementing resource conservation when not in use.

At first I thought this might be due to the fact that HTTP 1.1 keeps TCP connections open until such time as they are closed.  The initial delay would be the result of the connection being opened.  I don’t however think that this can be the case because I have included the Connection: Close header in my program now and the first request still takes some time.

Some other apparent solutions were that it was attempting proxy detection, waiting for an HTTP 100 or waiting because of something called Nagle’s algorithm.  I implemented fixes for each of these but to no avail.

I cannot at present see any way of fixing this problem or even of finding out the cause.  If I cannot fix it I will have to design my tests in such a way as to ignore it and still produce a valid result.

Published in: on August 12, 2009 at 1:01 am  Leave a Comment  

Tomcat, WebSphere and Geronimo

Here I was thinking that choice of web server would be a simple task.  Not for Java, no way.

Apache Tomcat is the first product that you are likely to stumble across.  Tomcat is used by many hosts, especially those offering cheaper JSP plans.  But it is far from alone.

The other big name in JSP it IBM.  IBM produces multiple server products under the name WebSphere.  I noticed that the community edition is based on yet another product: Apache Geronimo.

Apache Geronimo is basically a combination of dozens of Apache and other open source projects.  It is a fully compliant Java EE application server.  Not surprisingly the JSP/Serverlet implementation is done with Apache Tomcat.

Yet another project is GlassFish.  GlassFish is the product made by Sun and like Geronimo is fully Java EE compliant.  I was far from surprised to learn that it implements the JSP/Serverlet standard by using a variant of Apache Tomcat.

Gotta go but lastly there is JBoss using… you guessed it Apache Tomcat.  Why not just use Tomcat????????

Published in: on August 7, 2009 at 12:11 am  Leave a Comment  

Initialising multiple client apps

In order to test my prototypes from multiple computers it is necessary to start the test application on multiple computers at the same time.  I will also need to synchronise the task that the test app is performing because the app will be multi purpose.

To start the app at the same time on multiple computers I have several options.  I could use psexec or runas to remotely launch the task on multiple machines.  After experimenting with this option I found it to be difficult to control.  Alternatively I can use some kind of timer to initiate each at a specified time.  I think that the best way I can do this is by using windows scheduled tasks – manually configured on each client.

Published in: on August 1, 2009 at 9:59 am  Leave a Comment  
Follow

Get every new post delivered to your Inbox.