How to maintain ViewState in web-farm environment?

D

Dominic

My question is about how to maintain view state in mobile ASP.NET
across postback / request in a web farm environment.

First of all, let's assume the web-farm does NOT use stick-session
feature. In other words, different web servers may serve different
requests in the SAME session.

In non-mobile ASP.NET, my understanding is that the view state
information is passed between each client browser and server with
every post-back. Even if the request is handled by another different
web server in the web farm, the viewstate information is still
available in the postback because it is stored in the request (not the
web server). Therefore, maintaining viewstate information is not an
issue in a web farm environment.

However, in mobile ASP.NET, view state is stored in session object
(ref: Building Microsoft ASP.NET Applications for Mobile Devices by
Andy Wigley and Peter Roxburgh - p. 386). In order to maintain view
state, is it true that the ONLY option is to store the session
information in a separate web server or database server (setting
<sessionState mode="StateServer" or "SqlServer"> in web.config)?
Without doing that, how can we maintain the viewstate across postback
in a non-sticky-session web-farm environment?

I don't quite like the idea of storing session information in separate
web server or database server. It is because one important reason of
running a web-farm is to increase availability. If the web-server / DB
server storing the session information fails, the whole web-farm will
fail to run properly. Right?

Any insight is much appreciated! Thanks!

Dom
 
K

Kevin Spencer

I don't quite like the idea of storing session information in separate
web server or database server. It is because one important reason of
running a web-farm is to increase availability. If the web-server / DB
server storing the session information fails, the whole web-farm will
fail to run properly. Right?

It is always good to be aware of, and account for, points of failure. As
this seems to be the only issue which troubles you, let me remind you that
SQL Servers can be mirrored, and that you can set up a Fail-Over SQL Server
in case the problem you described occurs.

If, on the other hand, you're trying to make sure that there are absolutely
NO points of failure, I would suggest using an abacus. ;-)

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
D

Dominic

Kevin, thanks for your reply.

Let me put my question in another way.

Let's assume the following:
- I don't want to set up SQL server to store session (say, for the
sake of performance) and so I use "Inproc" mode for session state,
- The load-balancer DOES support sticky-session, and
- I don't want to use abacus

Can I conclude that the session and viewstate information can be
safely maintained in the web server in this web farm environment for
mobile ASP.NET?

Dom
 
J

John M Deal

Be aware that you will still have session problems with InProc if the
servers in your farm are multi-processor machines running IIS6 with web
gardens enabled. This is because each processor will be given its own
worker process and each worker process will have its own session and
application objects in memory. Application isn't a problem bu session
will be if you don't at minimum configure StateServer on the same
machine for the two worker processes to talk to. This may not be an
issue for you (if you are not using IIS6 or web gardens) but it is worth
mentioning when someone is looking for possible issue.

Have A Better One!

John M Deal, MCP
Necessity Software

P.S. I just noticed the mention of the "mobile" qualification and have
no idea how that impacts my statements above as I've never tried the
scenario with a mobile device but I still think it is worth mentioning
"just-in-case."
 

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,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top