Sessions allowed - should we clean them ourselves?

When we enable sessions in the Google engine, for example:

// appengine-web.xml <sessions-enabled>true</sessions-enabled> 

Does the application automatically clear expired sessions, or should we do it ourselves? After turning them on, I see in the data warehouse that some records are generated as _ah_session, I wonder if they are?

thanks

+4
source share
2 answers

Yes, these are session records. The Google Toolkit documentation for apps includes the following:

The implementation creates data storage objects of type _ah_SESSION and memcache entries using keys with the _ahs prefix.

( http://code.google.com/appengine/docs/java/config/appconfig.html )

How to clear session data. I found the following 2 discussions:

http://groups.google.com/group/google-appengine-java/browse_thread/thread/4f0d9af1c633d39a http://www.mail-archive.com/ google-appengine-java@googlegroups.com /msg01372.html

NTN, Steve

+3
source

From Clearing expired sessions from the App Engine data store :

You need to configure the cleanup servlet provided by Google to run regularly. Note: the servlet clears up to 100 records. Be sure to determine how often you need it to call, and determine the interval that suits you.

In web.xml:

 <web-app...> <servlet> <servlet-name>_ah_sessioncleanup</servlet-name> <servlet-class>com.google.apphosting.utils.servlet.SessionCleanupServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>_ah_sessioncleanup</servlet-name> <url-pattern>/_ah/sessioncleanup</url;-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <web-resource-name>session-cleanup</web-resource-name> <url-pattern>/_ah/sessioncleanup</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint> ... </web-app> 

And in cron.xml:

 <cronentries> <cron> <url>/_ah/sessioncleanup?clear</url> <description>Clean up sessions</description> <schedule>every 15 minutes</schedule> </cron> ... </cronentries> 
0
source

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


All Articles