Can memory pressure lead to eviction of session data in ASP.NET?

Does memory pressure ever generate session information in ASP.NET?

If so, will this only happen after all the caches have been evicted (even with CachePriority.Highest), or what is the threshold for this?

+4
source share
3 answers

The Session object is a single entity. If a session is interrupted due to lack of memory resources, the entire object is deleted, not the individual properties.

If you feel that the single values ​​in the Session object disappear, the most likely reason is that you have some kind of code that removes it.

+2
source

It will not be automatically flushed to save memory as well as cache. However, if the workflow runs out of memory, it will automatically restart. If you use InProc Session Storage, all sessions will be lost.

+3
source

Session and cache are, of course, volatile media. I'm not sure there is a priority that affects each other, but there are more factors than just the memory pressure that you need to consider. For example, a session will be cleared by a simple change to web.config (which processes the application pool). Of course, it is assumed that you are using the default session repository provider β€” you can switch to a non-working or SQL repository of sessions if this can help in your specific scenario.

+1
source

All Articles