I'm considering ditching all use of Session state in favour of
Application state.
This is because - from what I can work out - it will be more memory
efficient for me.
I have three questions:
1) When is memory used for Session State freed (or essentially freed)?
- if ever...
2) When is memory used in Application State (or essentially freed) - eg
- if my cache item expires due to it reaching it's expiration time - is
it freed immediately - or must the process wait for some cleanup job to
run.
3) does anyone know of any docs/articles on when *exactly* memory is
made available when using the various caching techniques?
cheers very much,
Oli. 6 1760
It seems to me that you have no basic understanding of session or
application state or you wouldn't be asking these questions and/or
considering "ditching all use of Session state in favour of Application
state". http://msdn.microsoft.com/library/de...ationstate.asp http://msdn.microsoft.com/library/de...ssionstate.asp
You really need at least this fundamental knowledge if you plan on
doing (successful) asp.net development. sp************* @yahoo.com wrote: I'm considering ditching all use of Session state in favour of Application state.
This is because - from what I can work out - it will be more memory efficient for me.
I have three questions:
1) When is memory used for Session State freed (or essentially freed)? - if ever...
2) When is memory used in Application State (or essentially freed) - eg - if my cache item expires due to it reaching it's expiration time - is it freed immediately - or must the process wait for some cleanup job to run.
3) does anyone know of any docs/articles on when *exactly* memory is made available when using the various caching techniques?
cheers very much, Oli.
<sp************ *@yahoo.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . I'm considering ditching all use of Session state in favour of Application state.
This is because - from what I can work out - it will be more memory efficient for me.
If your only sharing data at an application scope, and need no session
independence it makes sense! Thats a judgement call on your part. Be aware
that overloading any of the state objects can be a bad thing.
I have three questions:
1) When is memory used for Session State freed (or essentially freed)? - if ever...
When the session ends and the systems decides that all objects now out of
scope can be freed and garbage collected, I dont recall there being a fixed
duration as to when this happens. When the garbage collector decides that
sufficient garbage has accumulated that it is efficient to do so, it
performs a collection to free some memory.
2) When is memory used in Application State (or essentially freed) - eg - if my cache item expires due to it reaching it's expiration time - is it freed immediately - or must the process wait for some cleanup job to run.
When a cached object expires, the ASP.NET process removes it behind the
scenes immediately unless an active request for that cache item is
different to the retrieved value at request time and it needs to be updated,
then it updates the object if its priority is high enouigh to merit keeping
it cached. However, the type of cahcing and the expiration policy can see
the cache object reacting in different ways, for example if your using
sliding expiration, or SQL cache invalidation. If you keep adding items
to the cache and it gets full (ie. the free cache memory is exhausted),
ASP.NET will automatically invalidate and removes the oldest, least used, or
lowest priority items from the cache, hence you may not see your object
behave as predictably as you think it might. You need to be aware of this
if your going to use it heavily. Its worth having a read of Alex Homes
excellent article on this: http://www.devx.com/dotnet/Article/27865/1954?pf=true
3) does anyone know of any docs/articles on when *exactly* memory is made available when using the various caching techniques?
Not exactly, this is an easy read though and you can deduce when the memory
would be freed. Only tip I guess is to watch perfromance monitor to see
exactly whats happening. http://msdn.microsoft.com/asp.net/ar...cachingnt2.asp
also read about GC here http://msdn.microsoft.com/library/de...netchapt05.asp
cheers very much, Oli.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
I have more than a basic understanding -
I have been doing web development now for over 11 years.
I have worked in first class companies in the City and around the
world.
I have a degree in Physics, and an MSc in Computer Science and
Artificial Intellegence.
I am lead developer at an industry leading company.
I feel Applicate state may be more appropriate in my situation because
from what I can gather it offers more flexibility and control over
memory management than Session state does. I can "roll my own" session
state management on top of Application state if this is true...
I do not have to worry about cross machine scaling issues as I am
working in a Portal environment.
I appreciate your efforts at helping me sdbills - but I have the hump
slightly about your answer - sorry dude ;)
ok thanks john - the more I look at this the more I think that
Application State will be more efficient in my case.
There's still one key piece of info I'm missing though - and that is:
*exactly* when is memory made available in these two scenarios - and
how efficient are the processes that do the freeing - (ok that's two
points..)
you say "immediatel y" for Application state - but that seems unlikely
unless there is a resource intensive process doing some very close
monitoring. More likely I'd say is that there is a periodic monitoring
process - that runs ...say...every 5 secs or so - but I can find no
info on the exact mechanism. It's possible there is an event based
system that does as you say - it'd be great to learn more in this
case....
ok - thanks again for your help.
O.
....just to clarify - I understand well the garbage collection process,
and that it is difficult to determine exactly when memory will be
freed. What I am not clear on is when the memory is made available for
garbage collection - and I mean in more depth that "when it times
out"...
cheers all,
O.
I dont think I have the answer you are perhaps looking for!
A session ended, is ended - even if the session object has not been
collected as a managed object its reference at session.end (timeout for
example) is destroyed as an accessible object and the session object is then
subject to garbage collection. When exactly does the freeing occur, thats
pretty much impossible to say as its determined by heuristic rules inside
the garbage collector and uses something called non-deterministic
finalization to action events, which means that you cant exactly be really
sure when the garbage collector will action as it depends on what else is
happening in memory and how the heaps are being allocated and managed.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
<sp************ *@yahoo.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . ...just to clarify - I understand well the garbage collection process, and that it is difficult to determine exactly when memory will be freed. What I am not clear on is when the memory is made available for garbage collection - and I mean in more depth that "when it times out"...
cheers all, O. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Whitton |
last post by:
Hi, I am developing using ASP.Net using SQL Server and also have several
layers in between, eventually producing a custom business object that is
used to populate the web form. I don't use datasets because of performance
issues and also they just aren't proper business entities.
When it comes to updating my database I generally use an identity value and
a datetime value to avoid multiple updates. e.g. Update Customers set .....
where...
|
by: Jake |
last post by:
Does cookieless session state (with the sessionid embedded into the url)
interfere with the browser's retrieval of cached images from one session to
the next? Does the sessionid embedded into the url effectively limit
client-side image caching to the lifetime of the session?
Thanks
Jake
|
by: Steve Wark |
last post by:
If I create two aspx pages, place three text boxes (working with VS .net
2003 and web form controls) and a button on both forms.
On the first page, the button is set to use the "onClick" to open the second
page using Window.Open with the values being passed to the second page by a
global variable created in a Module added to the project, by the use of an
Application variable and by the use of a session variable.
In the page load of the...
|
by: baffled |
last post by:
I have both datatables and custom objects that are specific to a session and
need to be cached for such things as paging, sorting, etc... As far as I
can tell, there would be 2 basic ways to do
this:
1. Use session state to store these objects.
2. Use the System.Web.Caching namespace to cache the objects using a session
specific key.
So, is one of these approaches better (more efficient & scalable) than the
|
by: beaverme |
last post by:
Hi,
I have a series of web services. They all use require authentication and
successful authentication instantiates a Customer object which is used for
billing purposes. All of this is handled by a common base class. I'd like to
cache these Customer objects so that I don't have to make a database call
each time the service is called but I'm not sure of the best strategy. The
System.Web.Caching.Cache object seems to provide the required...
| |
by: Fred Nelson |
last post by:
Hi:
I have written several web applications that obtain their connection
strings from the web.config file. This is very easy to use and it makes
it easy to move an app from development into production.
I'm in the process of writing a site that will have lots of traffic so
I'm trying to save resources everyplace that I can.
My question is - do the web.config app settings get loaded once when the
|
by: George1776 |
last post by:
All,
I've recently upgraded our production ASP.NET/C# application from
framework 1.1 to 2.0. Since then I've been plagued by out-of-memory
errors and problems with the cache object (which may simply be a result
of being out of memory.)
We're running on IIS 5.1 on a single Windows 2000 server. We have a
separate database server - SQL Server 2000 64 bit. Session state is
stored on the database.
|
by: jason |
last post by:
hi experts,
support.microsoft.com/kb/917072 and
http://msdn.microsoft.com/msdnmag/issues/06/07/WebAppFollies/
As pointed out in these articles, users might get session variables belong
to other user ?
So ....Session state and kernel-mode output caching don't mix.
Has this bug been fixed?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |