I have a Tomcat 8 server that frequently runs out of memory. My guess as to what is occurring is that Tomcat does not limit the number of http sessions in memory, so if you get enough users, then the server will eventually run out of memory.
I know you can set a session timeout in your web.xml like so,
<session-config>
<session-timeout>30</session-timeout>
</session-config>
But that does not help if you get a lot of users in 30 minutes. I searched a lot for some way to limit the number of sessions, but surprisingly did not find much info. Seems like it would be a common issue, as Tomcat by default is guaranteed to run out of memory on high load.
So, how can you set a limit to the number of http sessions, such that Tomcat will expire the oldest when it reaches that limit? That seems like the only logical way to not run out of memory.