(0) exportieren Drucken
Alle erweitern

Session Affinity

Letzte Aktualisierung: Januar 2014

Within the Windows Azure Plugin for Eclipse with Java, you can enable HTTP session affinity, or “sticky sessions”, for your roles. The following image shows the Load Balancing properties dialog used to enable the session affinity feature:


To enable session affinity for your role

  1. Right-click the role in Eclipse’s Project Explorer, click Windows Azure, and then click Load Balancing.

  2. In the Properties for WorkerRole1 Load Balancing dialog:

    1. Check Enable HTTP session affinity (sticky sessions) for this role.

    2. For Input endpoint to use, select an input endpoint to use, for example, http (public:80, private:8080). Your application must use this endpoint as its HTTP endpoint. You can enable multiple endpoints for your role, but you can select only one of them to support sticky sessions.

    3. Rebuild your application.

Once enabled, if you have more than one role instance, HTTP requests coming from a particular client will continue being handled by the same role instance.

The Eclipse plugin enables this by installing a special IIS module called Application Request Routing (ARR) into each of your role instances. ARR reroutes HTTP requests to the appropriate role instance. The plugin automatically reconfigures the selected endpoint so that the incoming HTTP traffic is first routed to the ARR software. The plugin also creates a new internal endpoint that your Java server is configured to listen to. That is the endpoint used by ARR to reroute the HTTP traffic to the appropriate role instance. This way, each role instance in your multi-instance deployment serves as a reverse proxy for all the other instances, enabling sticky sessions.

Notes about session affinity

  • Session affinity does not work in the compute emulator. The settings can be applied in the compute emulator without interfering with your build process or compute emulator execution, but the feature itself does not function within the compute emulator.

  • Enabling session affinity will result in an increase in the amount of disk space taken up by your deployment in Windows Azure, as additional software will be downloaded and installed into your role instances when your service is started in the Windows Azure cloud.

  • The time to initialize each role will take longer.

  • An internal endpoint, to function as a traffic rerouter as mentioned above, will be added.

For an example of how to maintain session data when session affinity is enabled, see How to Maintain Session Data with Session Affinity.

© 2014 Microsoft