473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Scalable Application Design

Ive read that to build scalable web apps it is not recommended that state be
stored in session variables.

My understanding of this is that, with many users using the application
concurrently, the amount of memory required to store all their session
variables would very quickly exhaust the web server's memory. Also, if the
application is to run on a web farm, there is no guarantee that all requests
for a session will be dealt with by the same server. This could result in
Session("MyVariable") being stored in the ram of Server 1 but as the next
request might be dealt with on Server 2, it will be impossible to retrieve
the value from Session("MyVariable").

Is my understanding correct?

Instead I should store state in sql serevr for example. I can see how I
would easily do this with simple variables such as ForeName and DoB etc. Im
not sure how to deal with something a bit more complex. One of the things I
would my application does is, from a search page, have a collection of rows
returned and then pass that collection as a parameter to a next page. At the
moment I save my objResultsCollection in a session variable and then retrieve
this object in the next page (my classes are serializable). How should I
deal with this to make the application less dependent on session variables?
Mar 17 '06 #1
3 1433

"Terry Holland" <Te**********@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
Ive read that to build scalable web apps it is not recommended that state
be
stored in session variables.

My understanding of this is that, with many users using the application
concurrently, the amount of memory required to store all their session
variables would very quickly exhaust the web server's memory. Also, if
the
application is to run on a web farm, there is no guarantee that all
requests
for a session will be dealt with by the same server. This could result in
Session("MyVariable") being stored in the ram of Server 1 but as the next
request might be dealt with on Server 2, it will be impossible to retrieve
the value from Session("MyVariable").

Is my understanding correct?


This last part in incorrect.

Many load balancing switches can keep the same user going to the same
server. This has a timeout similar to the session timeout. The load
balancing timeout needs to be higher than the web server session timeout
otherwise the scenerio you described can occur.

This doesn't load balance accurately for small scales like 100 concurrent
users. For very large scales, statistics kick in and the load balancing is
very fair.

The disadvantage is shutdown complexity. If you need to take a server down,
you take that fraction of users with it (assuming the session variables are
maintained by the web server).

We use Foundary switches. The setup is not trivial.

Mar 18 '06 #2
Terry

Everything you read was true. Sessions == Evil. Well not really. This is the
web. And because of the stateless nature of the web you will ineviably need
to store things in the web.

That being said, there are certain things you can do you reduce your
dependency of sessions.

I wouldnt store your session state in a sql server unless your app was in a
webfarm. If it will then yea, you'll need to do that. Otherwise, you'll take
a hit on performance.

Rememeber that querystrings are our old but trust friends if you can get
away with it. Also the rows you have could be serialized and stored in
ViewState on a postback Or if you have to send them to the next page you
could stick them in Context and available on a Server.Transfer().

Ive had apps thats only store minimal user info in session and get
everything i need from querystring, viewstate and context.

HTH,
T
"Terry Holland" <Te**********@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
Ive read that to build scalable web apps it is not recommended that state
be
stored in session variables.

My understanding of this is that, with many users using the application
concurrently, the amount of memory required to store all their session
variables would very quickly exhaust the web server's memory. Also, if
the
application is to run on a web farm, there is no guarantee that all
requests
for a session will be dealt with by the same server. This could result in
Session("MyVariable") being stored in the ram of Server 1 but as the next
request might be dealt with on Server 2, it will be impossible to retrieve
the value from Session("MyVariable").

Is my understanding correct?

Instead I should store state in sql serevr for example. I can see how I
would easily do this with simple variables such as ForeName and DoB etc.
Im
not sure how to deal with something a bit more complex. One of the things
I
would my application does is, from a search page, have a collection of
rows
returned and then pass that collection as a parameter to a next page. At
the
moment I save my objResultsCollection in a session variable and then
retrieve
this object in the next page (my classes are serializable). How should I
deal with this to make the application less dependent on session
variables?

Mar 18 '06 #3
Hi,

Anthony Merante wrote:
Rememeber that querystrings are our old but trust friends if you can get
away with it. Also the rows you have could be serialized and stored in
ViewState on a postback Or if you have to send them to the next page you
could stick them in Context and available on a Server.Transfer().


I am not a big fan of ViewState myself. We developed a web application
which runs many days, possibly even weeks without restarting IE. Some of
the pages are automatically refreshing themselves using a postback. We
found out that if the viewstate is big, this might cause a memory leak,
because the previous page is cached in the browser's history. Granted,
this is not a very common situation (web applications are mostly running
a few hours maximum before the browser is restarted), but Microsoft
acknowledged the problem, and we decided to move away from ViewState
everywhere possible to avoid this kind of problems.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Mar 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dean J Garrett | last post by:
Hello, We're beginning to build a new .NET application that must be very scalable, i.e. to address future load requirements, we'd like to be able to simply add additional web servers. How do you...
1
by: Dean J Garrett | last post by:
We need to determine the proper architecture for a new .NET application which must be scalable, i.e. we must be able to add additional web servers as the need arises in order to accommodate...
4
by: Jonas Hei | last post by:
I need to develop a server application which would listen for UDP messages (on a certain port, say 8464) and process each message (which entails storing that data in the database) and then respond...
4
by: SRLoka | last post by:
After reading the newsgroups and various .Net web sites, I have come to a conclusion that BeginReceive and BeginSend are the way to go as they use IOCompletion Ports(I have no clue what they mean...
3
by: Brent Borovan | last post by:
Hello, Our team is about to begin development of a web based product using ASP.NET 2.0. We want to ensure that our architecture is scalable (n-tier) and easy to maintain. I've read up on the...
2
by: Simon Shaw | last post by:
I am that rare point in a developers career where I am starting a new web based project and I have a 4-8 week slot to train myself in the most appropriate technology for this task. As a non-web...
2
Niheel
by: Niheel | last post by:
Google launched a fully scalable web application platform today dubbed, Google App Engine. The platform allows developers to focus in on the application development and let Google handle the...
1
by: hyperboreean | last post by:
Hi, I am writing the application server for a three-tier architecture and sending the client's response in xml. My question is: is there a way to build the xml dom in a more scalable way and faster...
1
by: CyrexCore2k | last post by:
Hello all, Apologies if this is the wrong forum. This one seemed to be the most appropriate. I'm looking for resources pertaining to developing scalable and flexible application designs. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.