The Wikipedia Library program page (https://wikilink.wmflabs.org/programs/1) and a number of organisation pages currently don't load due to hitting the 30 second nginx timeout. The database queries for loading the data happen on page load and take an excessive amount of time to execute. The biggest offenders are the LinkEvents over time graph and the three breakout tables for top organisation/editor/project/page.
Instead of calculating the data for the tables and other figures on every page load, we should add new models to store this data, calculating it asynchronously. Page loads would then pull this data instead of waiting for lots of calculations.
Another option could have been to use caching, by crawling each page in the background so that cached versions were always available. This isn't feasible here because we have date range filtering - it would be impossible to load each combination of dates.
Acceptance criteria
- All program and organisation pages load within 5 seconds.