[KLUG Programming] PHP application & fault tolerance

Richard Harding rharding at mitechie.com
Sat Aug 19 12:40:50 EDT 2006


phillip hebenstreit wrote:
> Hello all,
> 
> I'm on a fact finding mission before starting development on a web 
> application, we are considering using PHP for this, here are some 
> requirements listed below.  Could anyone give me any suggestions based 
> on their experience with PHP application development?
> 
> I am sorry if I miss something or do not describe myself clearly, please 
> excuse me if I forget something obvious.  I'm in that great position of 
> learning as I go.
> 
> requirements
>   fault tolerant web application
>   sql replicated across 2 servers
>   apache fault tolerant
>   application needs a high level of up-time
>   user should experience very little down time
> 
> known information
>   sql replication is well documented,  so sql part is taken care of.
> 
> unknowns
>   apache's fault tolerance ability
>   php's fault tolerance ability
> 
> background
>   this is within the range of a "normal" web application, just needs to 
> be fault tolerant in case a server goes down.
>    user logs in
>    application stores data from user in MySQL tables
>    get data using queries
>    pages & menu's are user friendly
>    pages display info from database using the queries
>    reports output using queries
>    all the stuff most every website does
> 
> question:
>   Is there a way to develop this using PHP so that if my primary Apache 
> server goes down, my PHP application can continue running with minor or 
> no user downtime?
> 
> 
> ideas:
>   I suspect, if I cluster the apache side that would take care of the 
> apache part, but  could the PHP application still function if the 
> specific apache server the user is on goes down or would the PHP part fail?
> 
> alternatives:
>   I am thinking this would need to be done as a Java application, 
> because of the fault tolerance requirements, since the Java could be 
> running on the user's computer and would have logic that could direct it 
> to a list of servers based on availability.  (or could this also be done 
> with PHP? )
> 

I think this is going to have more to do with the network you setup for 
this. The only tie PHP will have with a machine is going to be your use 
of session. Moving sessions to a database backend should solve this 
issue for you with no problems. Basically the client tells you what 
their PHP Session ID is and you match it up in your database. Since all 
apache front ends should be using the same db backend, any apache server 
can server up any client. I think in order to get the apache side to 
work correctly you'll need some sort of load balancer or concentrator on 
the network so that the client is requesting IP .3 while the actual 
server responding is one of a series of apache front ends you have 
available.

Does that make sense? It's not something I've tried out, so take it all 
with a grain of salt.

Rick


More information about the Programming mailing list