Managing Session State using aSMSBy Balaji
For a background on maintaining state in a Web farm, be sure to read Dennis Angeline's Managing Session State in a Web Farm. This article will focus on how to manage state in a Web farm using aSMS.
asp Session Management Server
aSMS uses LDAP to maintain state information in a Web farm. LDAP can be a centralized server in the Web farm. All the webservers (aSMS) are mapped to this centralized LDAP server. aSMS uses LDAP because LDAP is optimized for fast single read and write operation. LDAP may internally use a database to store the data.
aSMS uses ADSI to communicate to the centralized LDAP server. ADSI will work with any directory service that offers an ADSI provider like LDAP. The LDAP provider works with any LDAP version 2 or version 3 directory. This means aSMS can use any LDAP servers on any OS theoretically. Currently aSMS has been tested on Microsoft LDAP server i.e. Microsoft Site Server 3.0. Microsoft Site Server 3.0 installs LDAP and uses MS Access or SQL server as internal database.
The aSMS uniquely identifies each user by automatically generating a globally unique identifier (GUID) for all users on their initial visit. The GUID is then used as a key for storing information in the LDAP. The GUID is returned to the client as part of the HTTP response, and is stored as a cookie on the client's machine. When the user returns to the same host, the browser automatically packages the cookie in the header of the HTTP request. The aSMS on the server checks for the existence of the cookie in the HTTP request to determine if the request is from a new or existing user. If the cookie is present, the request is from an existing user, and the object is initialized with the information specific to that user. If the cookie is missing, then aSMS assumes the request is from a new user, and a new GUID is generated. In all cases, the process of identifying the user and initializing the LDAP is hidden from the ASP developer. The aSMS handles the mapping internally.
aSMS acts as a kind of broker in between web servers and LDAP server. aSMS also provides a wrapper around ADSI so that the LDAP server need not be installed on each and every webserver or in any webserver. LDAP server can be a centralized stand-alone machine and all the aSMS (webservers) can be mapped to this LDAP server.
In IIS Session Starts automatically when the users hit the first web page, usually
default.asp. In aSMS developers have the flexibility of starting the
session in any page from where they want to use session variables.
aSMS does not use IISís Session management. It uses itís internal session management tool. Developers can disable the IIS Session State from MMC there by conserving lot of resources.
In Part 2 we will look at how to use aSMS to perform many common Session tasks.