Skip to content

cache sql query results using dogpile/beaker #2353

Closed

Description

@joetsoi

I don't believe we actually cache any of our sql queries, as a result we end up with repeated requests, for example model.User.get() is run when we run check_access anywhere in the templates, so on some pages we end up fetching the user a couple of dozen times.

I haven't had an indepth look, but we have the beaker caching middleware enabled, but as far as I can tell, we don't actually use it anywhere to cache results returned by sqlalchemy. The sqlalchemy docs now recommend using dogpile over beaker I think both were at some point written by the sqlalchemy guys

http://beaker.readthedocs.org/en/latest/configuration.html
http://dogpilecache.readthedocs.org/en/latest/

Activity

  1. self-assigned this
    on Mar 17, 2015
  2. rossjones commented on Mar 1, 2016

    @rossjones
    Contributor

    This is worse than it appears, as we were actively avoiding the local sqlalchemy 'cache'.

    For .get() calls this should be fixed by #2824 and #2825 where the ID is passed (because the 'cache' is an identity map on the PK).

  3. added 3 commits that reference this issue on Apr 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions