Is my ASP.NET session too big?

In our .NET web application, we have a session object for each registered user, which is about 5-7 kilobytes. The session stores a Dictionary object that contains a pair of classes and a user authentication token. Does this session size seem too big? I really don't know what good size or what good practices I should follow for sessions. Do you have any ideas? Thanks

+3
source share
5 answers

Insert only a session, which is absolutely necessary in order to be there. Otherwise, cache it or retrieve it from another location using the identifier that you store in the session. If it can go somewhere else, chances are it should go instead of your session object.

+2
source

TheTXI and DevelopingChris provided best practices, but here is the final answer to your main question: only you can tell if the session is too big. If you do not encounter memory problems on your web servers (or traffic between websites and the state server, if you use an external state server), your session is not stored too much; if so then that.

, , , , , , , , , , , .

+2

, , .

asp.net , .

, , xml, , .

+1

It depends on your scalability requirements. 5-7K * 1000 concurrent sessions = 57 MB. Assuming you have enough RAM, you should be fine. However, you should be very careful about what is stored in the session and avoid storing what is not absolutely necessary.

+1
source

Not if you need it. You should go through it and see what you can use more in the cache or leave in the database.

0
source

Source: https://habr.com/ru/post/1710180/


All Articles