in reply to Re: CGI script on cluster server
in thread CGI script on cluster server

Thanks for all the help guys.

Basically the set up is this: we have a cluster of 2 nodes and a shared drive on which my CGI scripts will sit. The idea behind this being that if one node goes down, the other can take over - load balancing is not a concern.

So if node A is in the middle of running my CGI script and goes down for some reason, how does node B take over? Does it automatically re-run my script from the beginning with the same paramters leaving me to co-ordinate this? Or can a clustered server co-ordinate the second node such that it automatically takes over at the point of failure?

thanks,
A

Replies are listed 'Best First'.
Re: Re: Re: CGI script on cluster server
by blue_cowdawg (Monsignor) on Jul 14, 2003 at 18:17 UTC

    What you are asking about I believe is actually beyond the scope of this on-line community's regular discussion.

    However, let me say this about what you are asking about since I have some small experience with what you are talking about.

    Perl CGI is not going to have any mechanism built into it for clustering and recovery of "in-flight" transactions. If you lose a cluster node in the middle of the execution of something as transient as CGI code, sorry it is going to be lost.

    You can do stuff though to help in recovery of the user experience. What I'm going to suggest is not all inclusive, but will help.

    If your scripts have some notion of a "session" and you use some sort of back end persistance storage (shared of course) to store the state of your session along with enough hints at least then your user can hit "refresh" and continue their session. However this is not foolproof and should be implemented carefully with proper session timeouts etc.

    You will notice I have not mentioned cookies. These can be used as well for sessioning and providing the CGI with arecovery point. My personal preference is to not use them but to code a SESSION_ID in my HTML code that is feeding the CGI.

    Hope this helps.


    Peter L. BergholdBrewer of Belgian Ales
    Peter@Berghold.Netwww.berghold.net
    Unix Professional
      Peter,

      I know this is beyond the normal discussions round here, but it's an application of Perl that I'm sure I'm not the only one involved in. Plus, there aren't that many other communities around like this one that would help.

      So a failover won't be transparent to a user if it occurs while they are waiting for a response from a CGI script that they've just submitted a form to? Ie. They get a page timeout and must hit refresh to resubmit the request?

      A

            So a failover won't be transparent to a user if it occurs while they are waiting for a response from a CGI script that they've just submitted a form to?

        I'm willing to be educated, but every clustering mechanism I have seen (including VMS clustering) suffers from this problem. There just ain't any way for a node in a cluster to pick up mid CPU cycle on an executing program.


        Peter @ Berghold . Net

        Sieze the cow! Bite the day!

        Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

        Brewer of Belgian style Ales