Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Out of proc SessionState memory management

We're using an out-of-proc session state service/ASP.Net Session state. We know were having problems with this as it's been abused in the past, too much stored in session state too often, so were in the process of moving onto a more scalable system.

In the meantime, though, we're trying to get our heads around how a session state service manages it's memory and what limits do we have. But none of the Microsoft docs seem to go into any details.

Specifically I want to know:

  • What are the limits to how much "the standard" out of proc session state service (installed along with IIS in the windows management console) can store? (x64)
  • Is there a per user limit?

by standard service, I mean this one:

enter image description here

like image 286
Liam Avatar asked Nov 10 '22 02:11

Liam


1 Answers

There is no limit beyond that of the machine hosting the service. If it has 16 gigs of RAM, assuming a few gigs are used for other processes / the OS / etc., there would be something like 13 GB of memory available for the session data. The data is not persisted to disk so the data only ever exists in RAM / memory; this is why when you restart the service all sessions are gone. The memory is volatile and works like a RAM disk.

If you're reaching the memory limits of the machine hosting your session state service, you are either storing too much data per user, or have too many users storing a little data. You're already on the right track as the next step is moving to a distributed session state provider to scale correctly. This is often achieved via a distributed caching system which comes with a session state provider, or by writing your own provider against said system.

There is no per-user limit on data, but note that out of process communication always happens via serialization. Therefore, there is a practical limit as serializing/deserializing a gig of user data per request is going to be very slow no matter how you approach it.

like image 146
Haney Avatar answered Nov 15 '22 07:11

Haney