Re: Best practice : storing objects in session-variables ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Whether it is or is not good practice to instanciate the object each time
often depends on what the performance impact might be, and whether holding
state of an object may cause other issues. DB connections for example
should always try to connect, extract/update data and disconnect, so if your
class is holding connections open it then storing it in the session is not a
good idea as you could in theory run out of available connections and
pooling is less efficient.

Also, on a heavy traffic site, adding memory hungry objects to session can
grind your server to its knees. So, you will need to test how your
application performs with objects in session, and without them - and make a
design decision.

Regards

John Timney (MVP)


<david@xxxxxxxxxx> wrote in message
news:fu3df2df30e1g446od2spphtijj3l8676o@xxxxxxxxxx
I have a class with some business-logic and with every roundtrip, I need
an instance of this class, so I have to create it, every time again.

That doesn't seem very efficient. I thought it would be 'better' to store
an instance of this class in a session-variable, so it's available all the
time
and needs to be instanced only once.

Is this, generally speaking, a good idea, storing objects in
session-variables ?
Do you guys ever use this 'technique' ?

Or, in other words, what's the 'best practice' when one wants to
use objects (and/or want to do OO-programming) in ASP.Net ?

Who can give me some insights ?


.



Relevant Pages

  • Cisco IOS IPS issue
    ... connecting to an MPLS cloud with about 40 sites and on my Gi0/1 port I ... After enabling IPS on the Gi0/0 outbound interface, ... session thresholds are well below max connection limits. ... max-incomplete tcp connections per host is 100000. ...
    (comp.dcom.sys.cisco)
  • Re: Configure SBS Remote Desktop for one session ONLY, BUT not locking new connection attempts
    ... Sorry, Russ, but the /console switch only connects if the server ... I log on to my own session in the server, from another workstation, ... Once at the remote site, I figure I need access to some data that I ... connections limit (whenever you're able to connect with an already ...
    (microsoft.public.windows.server.sbs)
  • Re: Concurrent connections for PIX
    ... > I'm aware that there can be multiple connections on a single website. ... I did not get a chance to measure & observe the problem, as the campus ... The other issue we had is with UDP. ... of a UDP 'session' is with simple timers. ...
    (comp.security.firewalls)
  • Re: maximum number of sessions
    ... NAS and SAN storage devices generally run one of the free Linux ... that's also two connections. ... like to know why mapping to an ip address creates an additional session to ... We have 6 pcs connecting to a 7 pc we call our server. ...
    (microsoft.public.windowsxp.network_web)
  • Re: RWW - log off after timeout?
    ... There is software out there that does allow for multiple connections to XP ... doing something at the time of the logoff or if the session has just been ... really need a way to determine if the RWW part of the session has "timed ...
    (microsoft.public.windows.server.sbs)