Session affinity

Stanley Gambarin (gambarin@openmarket.com)
Wed, 04 Dec 1996 14:10:30 -0500

Message-Id: <199612041910.OAA05987@u4-138.openmarket.com>
To: Ben Davenport <bpd@merc.com>, fastcgi-developers@openmarket.com,
Subject: Session affinity
In-Reply-To: Your message of "Wed, 27 Nov 1996 14:17:05 MST."
             <v03007829aec25f4c7c96@[204.255.152.44]> 
Date: Wed, 04 Dec 1996 14:10:30 -0500
From: Stanley Gambarin <gambarin@openmarket.com>

> 
> On another note, do you have any plans to implement connection affinity
> like that available in the Open Market server?
> 
	Intro:
	Session affinity is the concept by which requests from the same
host [and possible same client] would be routed to the same FastCGI 
application.  As such, affinity can be used to cache results for improved
Web server and database access performance.  
	
	Problems:
	Unlike OpenMarket's Secure Web Server, Apache does not provide any
mechanism to track user sessions and as such has no support for session 
affinity.  In order to provide the aforementioned support, the following 
must be accomplished:
		- allow a mechanism by which a server assigns sessions ids.
		- route request to appropriate fcgi app based on session id.

	Consideration:
	mod_fastcgi must not be concerned with how the sessions are actually 
defined.  All that mod_fastcgi must know is that there is a session id at a
certain place in the request.  (if it's not there, then session affinity is
disabled).
	The function of mod_fastcgi is to hash the session id into nprocs-1,
where nprocs is the number of instances of the requested FastCGI app and route
the request into appropriate socket.
	Each instance of the FastCGI application process must have it's own
listening socket, instead of sharing one socket.
	FCGI_PROCESS_ID environment variable should be set to reflect
current process number [0..nprocs-1].

	Once again: mod_fastcgi MUST NOT IMPLEMENT SESSIONS, it must only
use them.  There is a number of ways to implement sessions and it is not our
responsibility to do that.  A few possible solutions are Cookies or 
assignment of session IDs based on the hostname and then using internal
redirection to send the session info.  Since Cookies might not be always
available and/or supported, it is not a general solution.  Instead, one might
implement a mod_session module that deals with sessions in a constant manner.

P.S. If someone plans to implement session affinity for the mod_fastcgi, please
write to the mailing list, so that we may discuss it and provide any 
suggestions, without duplicating the effort.
						Stanley.

-- 

*******************************************************************************
* Stanley Gambarin			Open Market Inc.		      *
* FastCGI (soon-to-be) Guru		245 First St. Cambridge MA 02142      *
*					(617) - 949 - 7487		      *
* mailto:gambarin@openmarket.com					      *
* 				http://acs2.bu.edu:8001/~stanleyg (school)    *
*				mailto:stanleyg@cs.bu.edu		      *
*******************************************************************************