The invention relates to computer systems, and more particularly to a method and mechanism for implementing sessions in a computing system.
Computing systems, e.g., networked database management systems, often employ a multi-tier structure to manage and access data stored in the system. Referring to FIG. 1, an example three-tier structure is shown that includes a back-end resource server (e.g., database server 102) to manage and store access to data resources, a middle-tier server 104 (e.g., an application server or web server) and any number of client applications 106a-c (e.g., a web browser application).
In a common use for this type of architecture, a web browser at a client 106a will seek to access a particular web page. The web page may include or incorporate data from a back-end database 108 that is managed by database server 102. This type of request can be made, for example, as a specific URL or a HTML-based statement requesting data to be displayed on the web browser. The request is sent from client 106a to a middle tier server 104. The middle tier server 104 will have sufficient information about the location of the data to be able to route the request to the one or more specific database servers 102 that can fulfill the request and obtain the requested data from database 108. The requested data may be routed back through middle tier server 104, where it could be appropriately packaged for display on the web browser at client 106a. Alternatively, the data could be directly sent from database server 102 to client 106a. 
To process the request at the application server 104, a “session” may be created and assigned to a specific client. The session is set of assigned resources that is used to perform work on behalf of a client. For example, the session may include assigned context or memory resources. In addition, access management may be performed in which the client is authenticated by the system before being assigned to a session that is given appropriate access to the database server 102. An example approach for managing access and performing authentication in an n-tier computing system is described in U.S. Pat. No. 6,286,104, which is hereby incorporated by reference in its entirety.
In one approach, a dedicated session is specifically allocated for a given client request or client, and the dedicated session only performs work on behalf of its assigned client. The session in this approach cannot be shared with other clients. Instead, each other client must specifically allocate and de-allocate its own dedicated session as needed. Typically, there is significant amount of overhead involved to perform the task of creating a new session and allocating the resources need by that session, particularly if the database is remote. Additional overhead is incurred to destroy the session after it is no longer needed. The expense of having to separately create a new session for each and every client application could be prohibitively expensive and could significantly affect the performance and efficiency of the overall system.
In an alternate approach, a pool of sessions is created that is shared among a number of different clients. Instead of specifically assigning a dedicated session for each client, each client may be assigned an available session from a pool of sessions. This approach may be more efficient than the approach of dedicating a session for each client, since the idle sessions can be reassigned to be used by other client, maximizing the efficient use of resources assigned to sessions. Moreover, this approach is more efficient since the costs involved in forming sessions can be performed once for each live session, and not incurred again for each additional client that uses the session.
The middle tier application can be responsible for managing session pooling for application users. In this approach, users authenticate themselves to the application, which uses a single identity to log into the database and maintains all the connections.
The present invention provides an improved method, mechanism, and article of manufacture for implementing session pools. In one embodiment, a session in a session pool can be customized to with a specific set of affinities and attributes. Tags can be associated with the customized sessions. When a later request is made for a session having a set of desired characteristics, the tags can be used to search for and identify a session in the session pool having the requested characteristics. An alternate embodiment of the invention is directed to dynamic sizing of session pools, in which the number of sessions in a given session pool or sub-session pool can be dynamically adjusted upwards or downwards.
Further details of aspects, objects, and advantages of the invention are described below in the detailed description, drawings, and claims.