What are the disadvantages of using session?

Asked 15-Nov-2017
Viewed 493 times

1 Answer


0

Disadvantages of using a session!

What are the disadvantages of using session?


    On the technical demand of having a good performance in terms of speed and output, we always look up saving and relieving all our unused resources.

    So looking up on to those requisites, now heading up displaying how can we overcome or increase the efficiency considering session in our list!

    The below-given point would help to understand how session been one of the bullets in hampering the efficiency of the system:

    Performance and Memory:

    All the session data is been stored in the application pool’s memory if you store session state, which is in process. For multiple users at the same time, you can imagine the problem being faced by them. The problem worsens when they shut down the window without logging out of the in-process session and hence it would be still been holding upon the memory that the resources be allocated with.

    All the session variables would end up forming a spider’s web if you store session out of the process. By adding more variable, data can be pulled up more and hence you land up degrading the performance

    Concurrency:

    In case the session date is been used by the web application, all the data that is been stored in the session state need to be protected from the multithreading and race condition concerns.

    Well, as a result of the above point, in ASP.NET it automatically serializes the request that uses session. For example, if you send two requests at the same time, it would not touch the second request until and unless the first one is been finished. This particular trait of ASP.NET causes poor performance over an application.

    Infrastructure:

    If session state is been stored in the local memory, and your web application is been equipped with the load balancer then, the session stickiness is been enforced by it using IP address or a cookie. Hence, the load balancer has been a constraint in the way of handling its request.

    All the request hit on the same server hence landing up in the reduction of the overall performance and redundancy is been eliminated.

    Loss of data :

    In case the application pool memory is been recycled, all the session state is been lost and thus the user has to log out and restart. 

    Poor code design :

    All the session variables are the global variables and overuse of such variables may lead to the sloppy structure of the code. Hence, a variable should always be scoped as tight as possible.

    These particular points can be considered to upgrade the performance of the system...

    Hope this works well!

    All The Best! 


      Comment
      Thanks for the details. - Anonymous User14-Mar-2019