What's the current wisdom on storing objects in the Application Variable?

Discussion in 'ASP .Net' started by Frank Rizzo, Jan 13, 2004.

  1. Frank Rizzo

    Frank Rizzo Guest

    In classic ASP, it was considered a bad idea to store VB6-created
    objects in the Application variable for various threading issues.

    What's the current wisdom on storing objects in the Application variable
    in ASP.NET?

    I am thinking of storing several objects there, not too large, so there
    won't be any memory issues or anything like that. Is ASP.NET still
    subject to threading issues?

    Thanks.
     
    Frank Rizzo, Jan 13, 2004
    #1
    1. Advertising

  2. Frank Rizzo

    Hermit Dave Guest

    any shared objects do need to worry bout threading... so make it thread
    safe...
    use lock / mutexs etc to make it thread safe..

    and application isnt the best place to store any data.. instead try using
    cache object
    cache object is smart... you can set the priority and you can set absolute /
    sliding expiry times.. you can set callbacks if the object is unloaded...
    and most important... cache removes object if its overloaded... and the way
    it removes it is based on priority set by you..

    application on the other hand would cause a restart if overloaded with data.

    --
    Regards,

    HD

    "Frank Rizzo" <> wrote in message
    news:%...
    > In classic ASP, it was considered a bad idea to store VB6-created
    > objects in the Application variable for various threading issues.
    >
    > What's the current wisdom on storing objects in the Application variable
    > in ASP.NET?
    >
    > I am thinking of storing several objects there, not too large, so there
    > won't be any memory issues or anything like that. Is ASP.NET still
    > subject to threading issues?
    >
    > Thanks.
     
    Hermit Dave, Jan 13, 2004
    #2
    1. Advertising

  3. Frank Rizzo

    Hermit Dave Guest

    couple of links to help you

    creating multi threaded object in c#
    http://msdn.microsoft.com/library/d...gsimplemultithreadedcomponenetwithvisualc.asp

    cache object
    http://msdn.microsoft.com/library/d...html/frlrfsystemwebcachingcacheclasstopic.asp

    --
    Regards,

    HD

    "Hermit Dave" <> wrote in message
    news:...
    > any shared objects do need to worry bout threading... so make it thread
    > safe...
    > use lock / mutexs etc to make it thread safe..
    >
    > and application isnt the best place to store any data.. instead try using
    > cache object
    > cache object is smart... you can set the priority and you can set absolute

    /
    > sliding expiry times.. you can set callbacks if the object is unloaded...
    > and most important... cache removes object if its overloaded... and the

    way
    > it removes it is based on priority set by you..
    >
    > application on the other hand would cause a restart if overloaded with

    data.
    >
    > --
    > Regards,
    >
    > HD
    >
    > "Frank Rizzo" <> wrote in message
    > news:%...
    > > In classic ASP, it was considered a bad idea to store VB6-created
    > > objects in the Application variable for various threading issues.
    > >
    > > What's the current wisdom on storing objects in the Application variable
    > > in ASP.NET?
    > >
    > > I am thinking of storing several objects there, not too large, so there
    > > won't be any memory issues or anything like that. Is ASP.NET still
    > > subject to threading issues?
    > >
    > > Thanks.

    >
    >
     
    Hermit Dave, Jan 13, 2004
    #3
  4. Frank Rizzo

    Scott Allen Guest

    Hi Frank:

    You can keep a .NET object in Application state, but you do need to be
    careful to avoid concurrent access and bottlenecks.

    If the objects are not frequently used - consider the Cache object
    instead. 'Frequently' is a relative term of couse...

    It would still be a bad idea to store VB6 objects in Application state
    in ASP.NET, as they need to run in a single threaded apartment - but I
    don't think that was what you were asking.

    --
    Scott
    http://www.OdeToCode.com

    On Tue, 13 Jan 2004 12:15:37 -0800, Frank Rizzo <> wrote:

    >In classic ASP, it was considered a bad idea to store VB6-created
    >objects in the Application variable for various threading issues.
    >
    >What's the current wisdom on storing objects in the Application variable
    >in ASP.NET?
    >
    >I am thinking of storing several objects there, not too large, so there
    >won't be any memory issues or anything like that. Is ASP.NET still
    >subject to threading issues?
    >
    >Thanks.
     
    Scott Allen, Jan 13, 2004
    #4
  5. Frank Rizzo

    Frank Rizzo Guest

    Re: What's the current wisdom on storing objects in the ApplicationVariable?

    Scott Allen wrote:

    > Hi Frank:
    >
    > You can keep a .NET object in Application state, but you do need to be
    > careful to avoid concurrent access and bottlenecks.


    I want to store read-only objects that would be loaded in the beginning
    of the app via global.asax. This would have things like lookup lists,
    connection string, etc...things that would not change for the duration
    of the application. Given that the data is read-only, would I still
    have to worry about concurrent access?

    Given this information, do I still need to use the Cache object?


    >
    > If the objects are not frequently used - consider the Cache object
    > instead. 'Frequently' is a relative term of couse...
    >
    > It would still be a bad idea to store VB6 objects in Application state
    > in ASP.NET, as they need to run in a single threaded apartment - but I
    > don't think that was what you were asking.
    >
    > --
    > Scott
    > http://www.OdeToCode.com
    >
    > On Tue, 13 Jan 2004 12:15:37 -0800, Frank Rizzo <> wrote:
    >
    >
    >>In classic ASP, it was considered a bad idea to store VB6-created
    >>objects in the Application variable for various threading issues.
    >>
    >>What's the current wisdom on storing objects in the Application variable
    >>in ASP.NET?
    >>
    >>I am thinking of storing several objects there, not too large, so there
    >>won't be any memory issues or anything like that. Is ASP.NET still
    >>subject to threading issues?
    >>
    >>Thanks.

    >
    >
     
    Frank Rizzo, Jan 13, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig S. Ugoretz
    Replies:
    0
    Views:
    403
    Craig S. Ugoretz
    Feb 18, 2004
  2. Ian Pilcher

    The Wisdom of 6.5.5(6)

    Ian Pilcher, Feb 24, 2005, in forum: C Programming
    Replies:
    4
    Views:
    365
    Tim Rentsch
    Feb 25, 2005
  3. mdh

    transformation wisdom

    mdh, Oct 1, 2006, in forum: C Programming
    Replies:
    4
    Views:
    343
  4. Devon Null
    Replies:
    24
    Views:
    589
    Daniel T.
    Jun 14, 2007
  5. Devon Null
    Replies:
    15
    Views:
    481
    Devon Null
    Jun 8, 2007
Loading...

Share This Page