Opened 14 years ago

Closed 14 years ago

#12487 closed (wontfix)

authenticated user alwayse fetch from database for each request

Reported by: anonymous Owned by: nobody
Component: contrib.auth Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


even set the SESSION_ENGINE='django.contrib.sessions.backends.cache' or cache_db, and user has login, request.user is still always need to fetch from db for each request . and user groups, permissions will also need to fetch again when use. It takes too many cpu clocks.

why not save the authenticated user in session. a little things should to do is update the user in session when user object or user permissions or groups has changed.

Change History (1)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: wontfix
Status: newclosed

An interesting idea, but I don't think it's as simple as you make out. There are all sorts of cache invalidation issues hiding underneath this.

I am also highly skeptical that reloading the user, groups and permissions is a bottleneck in your application. I don't doubt that this *could* be optimized, but I find it hard to believe that this is the biggest performance improvement available to your (or any) project.

Marking wontfix for now, but willing to entertain discussion if someone is particularly enthused by the idea.

Note: See TracTickets for help on using tickets.
Back to Top