Skip to content

Smarter Views In CouchDB #11

@asonnenschein

Description

@asonnenschein

From Ryan:

When you hit that page (/metadata/record.iso.xml), Django sends a request to CouchDB requesting all of the urls. CouchDB responds very quickly, but then the crummy part starts. Django has to determine whether or not you have permission to view each one of the records. If you are logged out (an anonymous user), then Django has to pull out of the list each item that is unpublished. If you are logged in, Django shows URLs to unpublished records that you have access to. Django performs the authorization query one record at a time. Iterating over a large number of records takes a really long time, and eventually Nginx decides that there's not a response coming back and times out.

Remedies:

  • Change CouchDB view so that it only returns public records and Django doesn't have to run any permissions checks
  • Change the whole thing so that CouchDB is authentication-aware and only returns relevant records

Debugging on branch permissions.

Metadata

Metadata

Assignees

No one assigned

    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