A large number of http sessions in grails

I am running a grails 2.2.4 application on tomcat7 and Linux server. I see in monitoring JavaMelody (plugin) that more than 1000 http sessions are open, while only about 10 users are logged in. What's more, all those sessions that are not connected to users (I can see the username, if so) have a serializable size of 1.607b (user sessions have -1b).

I am wondering if something is wrong with this - I have another application, very similar in size, running on the same server with more than 200 users, as well as about 200 sessions - and if there is, what can I do to fix it it or find a reason.

Any help would be appreciated.

+4
source share
1 answer

Mmmm, are you using too many flash options?

Once you use the flash scope, Grails creates an HTTP session. The lifetime of this session depends on what is configured in web.xml, but by default it is 30 minutes.

As you can see, if many users click on pages with flash enabled at the same time (or within half an hour), your application will contain a large number of active sessions.

“Fix” is to reduce the session timeout to something significantly lower by editing web.xml

<session-config>
    <!-- 1 minute timeout for benchmarking -->
    <session-timeout>1</session-timeout> 
</session-config>

, , ! , , - , .

: http://grails.imtqy.com/grails-howtos/en/performanceTuning.html

+1

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


All Articles