Mark Rae said:
That's fine for a very small number of concurrent users, but is completely
non-scalable.
Imagine, say, 500 concurrent users and you will could potentially have 500
copies of the page's state stored in Session memory...
You bring up a good point, scalability should always be something that is
considered.... depending on the application being written and where used.
My suggestion was to keep in memory a copy of an object that could contain
datatables/datasets, various strings, longs, or other items as properties,
and who knows what else as it would depend on the need of the application.
So true, you could in effect have a single copy of the object in memory
taking anywhere from just a few KB to a few hundred. But what I would argue
is that even at a couple hundred KB per copy, the environment where massive
numbers of concurrent users would be encountered would dictate this
application be placed on a true server, and today's servers have many (if
not dozens) of GB's of memory. That coupled with effective and efficient
code to destroy objects no longer in use, garbage collection, and other
methods, make using the Session area for storage and retrieval of items as I
mentioned a highly valuable and accessible resource and tool to be
exploited.
You shouldn't be so quick to toss out the "scalability" buzz word and then
summarily dismiss the idea proposed. Mike has not mentioned what
environment this application of his will be run from (Intranet, Internet,
user population, etc.), nor do we know if my suggestion would be utilized in
just a segment of the overall application or be used throughout. If this
process were placed on a public page of a public web site, then yes, there
could potentially be thousands of concurrent sessions... but if this process
Mike's building is on a single page within the admin section of an Intranet
website, there may be less than half a dozen in memory at any given time.
I think it highly unfair of you to so readily judge a suggestion, and
attempt to bias the OP against it just as quickly, without knowing or
further discussing facts surrounding its possible implementation. That and
your "but is completely non-scalable" comment is in fact very false.
-- Andrew
Oh, btw, I was *not* suggesting keeping a copy of the state of the entire
page in memory (that's called ViewState)... I was suggesting having an
object that would have various properties whose values could be used to
designate if controls should be displayed or not, contain a datatable or
dataset that a ListView or GridView could be re-bound to avoiding a trip
back to the database, and other informational items as needed the page could
then access to help decide the state of the controls and such displayed on
the page.