Session varibles, loan balancing, and sticky sessions

D

DeeAnn

We've encountered a "flaky" situation with a Session variable holding
a data set on load balanced servers; server session with cookies is
set up.

Background:
Session variable holds a dataset.

Dataset is retrieved and updated periodically. Eventually the dataset
is sent to a web service for processing.

In production, the asp.net application is deployed on load balanced
servers, server session using cookies is configured.

Periodically, not always, the dataset does not update in the Session
variable. Then when the dataset is later retrieved, it retains its
origial values, losing updates. No error is encountered.

The problem has only occurred in the load balanced environment. In
general the session state seems to work. It just behaves oddly from
time-to-time when the Session variable is being used to hold a
dataset.

Any ideas on what configuration setting might be missing, and thus
causing the sporadic bad behavior? Appreciate any assistance.
 
J

Jeff Siver

Did you switch from InProc sessionState to StateServer or SQLServer? If
not, this is the problem.

InProc session state does not work in a balanced environment unless you
enable server affinity. Server affinity indicates that all requests from a
specific IP always go to a specific web server (so server affinity defeats
some of the purpose of load balancing).

Jeff
 
C

Cliff Harris

DeeAnn,
Jeff is right about having to use server affinity if you want to use InProc
Sessions. I just wanted to mention to keep in mind that InProc session are
somewhat volatile, and are subject to being lost when the asp_net process
decides to recycle itself, which it does on occasion. If you want to ensure
that you session will not be lost, you might want to look into using one of
the other session state management methods.

You can look here for a bit more information:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp12282000.asp

HTH
-Cliff
 
D

DeeAnn

We do have server affinity specified and this works for fine for all
our Session variables, and generally for this one as well. However,
with the one tha is storing a dataset, the original dataset is stored
and retrieved fine. It is just sometimes, the dataset is retrieved
(correctly) and stored again but when it is retrieved again, the
updated values are not there. Since the processd the developer used
(there are reasons for this), retrieves the dataset on a server post
(code behind file), makes changes, retrieves the dataset again and
then forwards it to a web service. All this is happening in the same
code routine, so the same server is being used. So, what seems to be
happening in the update of the dataset is not really occurring. It
generally works, and always works outside a load-balanced environment.
 
J

Jeff

If I had to guess, I would say that somewhere you are re-writing the session
out - maybe the garbage collector is running and disposing of an object that
is updating the session state. Or, an object is writing the session out
with the non-updated dataset after the updated dataset has been written out
(but I would have expected this to occur in all environments; not just a
load-balanced environment).

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top