MapGuide RFC 3 - Session Affinity

From OSGeo
Revision as of 13:25, 1 November 2006 by Wiki-Chrisclaydon (talk | contribs)
Jump to navigation Jump to search

Overview

When multiple MapGuide instances are accessed via a load balancer, problems arise when a request that requires a session that was created on one MapGuide site server is processed by a different server. The proposed short-term solution to this problem is to ensure that any requests that make use of a session and its related resources are always processed by the same server that created (and therefore has access to) that session.

Motivation

In a deployment that uses multiple, synchronized MapGuide Servers, a load balancer will typically be used to distribute incoming client requests to a number of MapGuide Web Tier deployments. Each instance of the web tier makes use of a single MapGuide Site Server in order to process its requests.

Many operations require the use of sessions in MapGuide. Once a session has been created, the server may create temporary resources in a session repository. A session repository is very similar to the main (Library://) repository, except that the resources it contains only persist for the lifetime of the session. Requests that require the use of such session-based resources can only succeed if they are present on the server. Thus, if the load balancer hits one web tier deployment, and hence one particular server when it creates a session, subsequent requests for that same session which get directed to an alternate web tier instance (and hence a different server) will fail. This is because the alternate server(s) knows nothing about the requested session, and does not have a copy of the session repository.

All requests related to that particular session will fail unless the load balancer happens to direct the request to the server that created it. Configuring a load balancer to determine the session and direct the request to a particular web tier instance would be complex and undesirable.

The proposal is to modify MapGuide to handle the problem so that the load balancer configuration can be trivial.

Funding/Resources

Autodesk to supply the resources to make the required changes.

Proposed Changes

The proposed changes represent a short-term solution to this problem. In the long term, steps should be taken to ensure that any of the available servers in a site are capable of accessing sessions created on any of the other servers.

The changes can be summarized as follows:

1) Modify the web tier so that it can be configured to access more than one site server - this allows each web tier instance to make use of all of the site servers. 2) Modify the web tier so that requests that require a session are always directed to the site server that created the session. 3) Modify the server code so that any support servers that require access to session resources are able to retrieve them from the appropriate site server.


Technical

To support item 1, the web tier needs to perform some rudimentary load-balancing to distribute requests among the available servers. A simple round-robin algorithm would suffice. Support for failover if errors occur or servers are taken offline is beyond the scope of this proposal.

To support items 2 and 3, some means is required to map between a session ID and the corresponding server.

Implications

Client requests, particularly from the MapGuide viewers, often depend upon a session, so most of the traffic from a given client will always be directed back to the same server.

Test Plan

Testing will require multiple site servers, support servers, and web tiers to be deployed under a load balancer. Testing should then be carried out by making requests from multiple clients accessing different sessions.