.NETGURU
create an object on every page, or save it in Session?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcache' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Francesco Sanfilippo
Situation #1 would create a User object, populate it from Session variables
(which were populated from a single DB hit on Session_Start), and destroy a
User object on every Page_Load.

Situation #2 would create a User object for each Session only once, on
Session_Start, and save the User object in the Session object, which would
be destroyed when the Session timed out.

Either way, the DB is hit only once, which is the real performance
improvement. Now I just want to figure out which method is more scalable,
yet high performance? Creating a small User object on every Page_Load, or
stashing a User object inside Session?

Francesco

>From: "John Crim" <Click here to reveal e-mail address>

[Original message clipped]

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

Reply to this message...
 
    
Francesco Sanfilippo
A final question on this...if I were to go with method 2, storing the actual
User object in Session, I could simply call any methods of that object on
any page at any time, without instantiating the object, or worrying about
Disposing it, assuming its Dispose() method were called on Session_End?

Francesco

[Original message clipped]

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

Reply to this message...
 
    
John Crim
Andy is right, web farm scalability may be another consideration. I'm
not sure if the Session server serializes objects when storing them - if
it does, both options will scale out just as well. If it only works
well for storing simple values, then #1 would be the choice for web
farms.

-----Original Message-----
From: Andy Smith [mailto:Click here to reveal e-mail address]

Without doing actual testing, anything anybody says will just be an
educated guess.

that said, my guess would be that #1 would be more scalable, while #2
would be more performant.

Reply to this message...
 
    
John Crim
Yes, that's part of the beauty of that technique.

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
Sent: Monday, January 14, 2002 9:14 AM
To: aspngcache
Subject: [aspngcache] Re: create an object on every page, or save it in
Session?

A final question on this...if I were to go with method 2, storing the
actual
User object in Session, I could simply call any methods of that object
on
any page at any time, without instantiating the object, or worrying
about
Disposing it, assuming its Dispose() method were called on Session_End?

Francesco

Reply to this message...
 
    
Francesco Sanfilippo
Wow, that is beautiful! Now I just need to find out from some of the MS
people if objects stored in Session on a dedicated Session server are
serialized...

Francesco

[Original message clipped]

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

Reply to this message...
 
    
Rob Howard (VIP)
If you use out of process session state, youl'l need to attribute your
class with [serializable]. Otherwise you'll get an exception when you
attempt to stuff the class into session.

Thx
rob

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]=20
Sent: Monday, January 14, 2002 9:35 AM
To: aspngcache
Subject: [aspngcache] Re: create an object on every page, or save it in
Session?

Wow, that is beautiful! Now I just need to find out from some of the MS

people if objects stored in Session on a dedicated Session server are=20
serialized...

Francesco

[Original message clipped]

_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.

| [aspngcache] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp =3D JOIN/QUIT

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification