People correctly said that the session contains several objects with a heavy weight. If there are enough users on your system, if you try to save them in the finite amount of memory available on the server, you will eventually encounter the server with the maximum amount of memory.
I worked on the project once when updating the production code had a memory leak. It was a J2EE project (yes J2EE, not Java EE). When a user logged in to verify his account with this telephone company, the user session was not correctly released from memory (I cannot remember the reason, but this is definitely a problem). This error mimics what you ask for intent.
The server continued to fail. Therefore, we put a profiler on it. We will ensure that memory usage increases during the day until it is completed and ended after the application server crashes. We added memory and increased the tuning of the VM memory. I told them it was a memory leak, but because I was not a “server expert” for $ 200 an hour, people didn’t want to believe it, because the people who were there still believed that The garbage collector was powerful, not just very good.
Two days later (this affected the “view your account” system, and not the main business system, that is, it did not have the same load or memory requirements, even if the servers had a lot of hardware memory), they hired a couple $ 200 per hour consultants who informed them every other day that they had the aforementioned memory leak. This was fixed, and everything was fine ... minus the fees of the consultants.
In any case, this is a cancellation: if you do not end user sessions when users log out or close their browser (session time), you risk maximizing your memory and crashing your servers, especially if your site or application has a significant number of users. As others have mentioned, it is best to use lightweight tokens / cookies.
Billr
source share