hasadna / openmuni-budgets

A web app and web API for storing, accessing, visualizing and comparing budgetary data from Israeli municipalities.
http://openmuni.org.il/
BSD 3-Clause "New" or "Revised" License
15 stars 28 forks source link

Implement cache strategy #378

Closed pwalsh closed 10 years ago

pwalsh commented 10 years ago

I've played with various cache implementations quite bait over the course of development, but currently, we have not settled on the appropriate strategy.

The data model is highly relational and in parts, complex (templates > nodes + sheets > items), and is not well suited for serving read queries. Part of the design is that, because these datasets change rarely, that all reads will be from cache (redis).

One option that is very efficient is to use query set caching. This is great if we have a set of queries that we know will be called time and time again.

Queryset caching does not cover the Open Budgets use case well, however, because we expect API calls with a range of params, and these are all distinct queries.

The desired behaviour is:

pwalsh commented 10 years ago

the only problematic endpoints, for current performance, are:

The 'items' endpoint is critical. This should be the focus, and then we'll move on once we have an implementation for this.

BeOleg commented 10 years ago

For some reason debug toolbar and model translation don't like each other, any idea how this could be resolved?. Costed me a few hours so far :(

pwalsh commented 10 years ago

Hi @BeOleg I see they don't work together, and I have no idea how to resolve it. I've in the middle of of making some changes to the items endpoint now for the upcoming launch with google. So, wait a few days.

Did you make any progress with caching until now?

pwalsh commented 10 years ago

@BeOleg I'm re-assigning this issue to myself - I'm doing some refactoring to this API endpoint & the caching as part of the contract between HaSadna and Google.

pwalsh commented 10 years ago

boom.