Posts Tagged ‘system Reliability’

Choosing a wiki, blog and forum system – and getting them to work together. (Part II)

Friday, August 14th, 2009

It is a few days after my post on the topic of getting the three open source applications – MediaWiki, WordPress and MyBB – all written in PHP using MySQL and running on Windows under IIS.   We seem to have reached an good level of stability since then – not perfect, but seemingly about 97%.  Considering the code for these three systems (and the code for the PHP and MySQL engines) is multi platform and open source, I think that is a pretty impressive outcome.  I am both surprised and impressed.

Compared to a commercial environment, open-source developers don’t have access to the same tools, nor the ability to hand pick and hone development teams over many years.  Debugging, optimisation and code tracing tools are simply not the same.  Contrast to a Delphi environment costing thousands of dollars per developer with full production grade debugging support and the ability to use commercially purchased components – the open source development team (if not necessarily the individual developer) must use a mixture of tools not necessarily purpose built to work together.  Teams self select, although inevitably filtering occurs over time, and project direction is committee based and therefore more difficult to keep focused than CEO based direction.  So the standard achieved by all of these components is remarkable.

In our case the instability seemed to be caused by insufficient memory being allocated to PHP.  We upped it to 256MB and the intermittent page failures disappeared.  I suspect we will need to go higher than that as the usage grows – or possibly lower, depending on whether the space is session based or shared. 

I am not sure how the PHP memory management interacts with the OS memory management, not whether the PHP memory space is shared between PHP applications, between sessions or specific to each session or application.  We, therefore, will adopt an approach of incremental growth/tuning until we have had a chance to read up on the PHP memory management system and had more time to understand the loads being placed on the servers.  I suspect that the PHP memory model differs between CGI and in-process implementations implementations anyway.   We have a number of large database and graphical processing systems on the dev cluster  so I don’t want to unnecessary rob memory from those systems, otherwise we would just allocate a few gigabytes to the PHP systems.  Based on the observed behaviour, I suspect it is shared between sessions and apps within the same inprocess server (which would make sense).  Whether is is assigned, or meerely available is another issue, and not clear at this point, nor whether unused memory is free to paged out of RAM or returnes to the OS when not required.

We are noting that we tend to have to specifically instruct the PHP apps to tell browsers not to store the pages in the caches (see the earlier post).  I think this is probably a good point for PHP programmers to note.  There are very few scenarios where a PHP web page should be cached – because by definition, they are generated – so it is a good idea to ensure that the header sent by the PHP page includes a ‘header(“no-store”);’ instruction by default – unless you specifically want it to be cached on the browser.

I must say: the more I look into the architecture and code of the WordPress system, the more impressed I am.  What is going on behind the scenes to display this blog to you is simply outstanding.  It is not so much the display method that is so clever (although that is clever enough), but the architecture and the administration/maintenance and update mechanisms are nothing short of brilliant.  There have been some very, very talented people working on this application.