Php application with session used in a cluster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
we are considering to use a php on several application servers behind the apache mod_proxy_balancer. Our php app is using session cookies. And we would like to use session stickyness - once the user connects to app server X and gets the session cookie, all other request will be ballanced (reverse proxied) to the app server X. We have these theoretical possibilities:

1. Into each response add own Set-Cookie: Cluster-Node=blabla.X
When user continues requesting the apache balancer the balancer knows to which app server redirect. From the value of own cookie Cluster-Node= reads the value X identifying the app server X. Problem: Does exist in the php framework something like .net post request handler? For better understanding replace the word /post by //after/. So after the request is processed by the php application code the "post request handler" is fired and calls header("Cluster-Node=blabla.X")

2. Modify the php session management system.
We need to add to php session value string ".X". Is there a way how to do it?

3. Write an own session management system for a single app server or for all of them.
The most work-intensive option ;-(

My resource is a paragraph from Apache mod proxy balancer manual
http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

Some back-ends use a slightly different form of stickyness cookie, for instance Apache Tomcat. Tomcat adds the name of the Tomcat instance to the end of its session id cookie, separated with a dot (|.|) from the session id. Thus if the Apache web server finds a dot in the value of the stickyness cookie, it only uses the part behind the dot to search for the route. In order to let Tomcat know about its instance name, you need to set the attribute |jvmRoute| inside the Tomcat configuration file |conf/server.xml| to the value of the route of the worker that connects to the respective Tomcat. The name of the session cookie used by Tomcat (and more generally by Java web applications based on servlets) is |JSESSIONID| (upper case) but can be configured to something else.

And the last possibility is:
4. Can apache mod_proxy_balancer stick cookies by the session cookie name?
Each app server can have its own session.cookie_name=PHPSESSION-X. But it is a query for a different forum...

Can anybody give me an advice?

Thanks.
Jan.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux