Overview of High Availability CGI

High availability CGI programs use APIs to preserve the CGI’s state between successive client requests. A High availability CGI program stores its state data on the Web server and can retrieve its state even after a failure or switchover of the HTTP Server or system.

Although maintaining a CGI program’s state across multiple requests is a concept used by both Persistent CGI and High availability CGI programs, the mechanisms used by the two types of programs are significantly different and a High Availability CGI program should not be confused with a Persistent CGI program.

During the configuration of a Web server, the server administrator indicates whether CGI programs are allowed to be cluster-enabled High Availability CGI programs. If the server receives a request for a CGI program that is allowed to be Highly Available (HA), the Web server passes to the CGI an environment variable that indicates the CGI may be cluster-enabled. The server also creates and passes a unique session handle to the CGI. The CGI program must then acknowledge that it is a cluster-enabled HA CGI program to the server, otherwise the server will regard the CGI as not being cluster-enabled.

The Web server associates a HA CGI program’s state with the unique session handle that was passed as an environment variable to the CGI. If a request to run the CGI is sent to the Web server, and the requested URL includes the specific session handle, the Web server will be able to correctly restore the previous state of the CGI. For this reason it is important that the session handle appear in all URLs that were generated by the HA CGI program to be returned to the client.

An HA CGI program will use two APIs to maintain its state. To store state information on the Web server, the CGI calls the API QzhbCgiSendState. To receive its previous state from the Web server, the CGI should call the API QzhbCgiRecvState.