Opened 16 years ago
Closed 16 years ago
#9292 closed (invalid)
SESSION_SAVE_EVERY_REQUEST behavior is overkill
Reported by: | Huuuze | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.0 |
Severity: | Keywords: | SESSION_SAVE_EVERY_REQUEST | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I recently added "SESSION_SAVE_EVERY_REQUEST". As the name implies, the session ID is changed for every request made to the server. IMO, this is overkill. If your page has 10 images on it, the session ID will be changed 11 times (once for the initial page request and then 10 more times for each image file request). This also means 11 writes
to the DB (django_session), which could be problematic for some publicly hosted sites.
It'd be nice if the behavior of this setting only refreshed the session on the initial page request and not EVERY request.
As noted on the mailing list - how do you tell the difference between a page request and any other request? At the middleware level (which is where the session save happens), all requests are equal.
Besides - you shouldn't be serving images with Django anyway. If you deploy your project using the suggested guidelines, this is a non-issue - media is served by some other scheme, so Django will only see one request.