The thing is, probably also on the tens of thousands of registered users of the site (using django1.6), session stored in the relational database, the online after the Discovery session table hundreds of thousands of data, expired session was not automatically deleted
Thinking
Official Session Document
The Django session can be stored in a variety of media, DB, file, cache (can also be defined), or you can use the cookie base session.
The default serialization method is basejsonserializer,1.5 and previous versions are using pickle
The default session time is 2 weeks, 1.2096 million seconds
Countermeasures
If the user actively exits, the session will be automatically cleared, if not quit on the reservation, the number of records more and more, to regularly clean up the useless session.
- Django has provided this method, it is recommended to add it to the crontab automatically clean out the expired session, prevent the session table record too large, affecting the speed of access.
django manage.py clearsessions
Copyright NOTICE: This article is Orangleliu (http://blog.csdn.net/orangleliu/) original article, the article reproduced please declare.
"Django" Optimization tips for clearing expired session