Skip to content

Cache event fragments and hence increase performance

Matthias Käppler requested to merge github/fork/jirutka/cache-events into master

Created by: jirutka

Dashboard page and project’s main pages are very slow due to events. It’s not so expensive to load events itself, but all their associations to generate event view. However, events represents history of project’s activity and thus they’re practically* immutable. So why not cache them? I mean cache fragment of single event under time ago (see _event.html.haml).

It’s practically one line change, but reduce load time of pages with events avg. 2 times (when all events are already cached)!

* I think that we can consider event itself as immutable, but not some of its associations, e.g. user can change his name or change project’s name. However, these situations are quite rare and it’s not so big deal as events are “history”. Therefore I don’t even care about invalidation of these fragments. If anyone does, we can add some invalidation observers.

Merge request reports