Hello all,
While cleaning (reviewing and rewriting) the code of Wikidata and Wikimedia Commons backend in October 2019, The Wikidata team at WMDE together with WMF worked on reducing the loading time of pages. We managed to reduce the loading time of every Wikidata page by about 0.1-0.2 seconds. This is due to a reduction of the modules (sets of code responsible for a certain function) that need to be loaded every time a page is opened by someone. Instead of 260 modules, which needed to be loaded before, only 85 modules need to be loaded now when the page is called. By doing so, it is easier to load Wikidata pages for people who only have a slow internet connection.
Link to picture on Commons: https://commons.wikimedia.org/wiki/File:Reduced_loading_times_cut.png
Description: Size decrease of the initialization loader on Wikidata pages (see on Grafana https://grafana.wikimedia.org/d/BvWJlaDWk/startup-manifest-size?orgId=1&from=now-6M&to=now&var-wiki=enwiki&var-component=All&var-multiwiki=wikidatawiki&fullscreen&panelId=59 )
Reducing the amount of modules called when loading the page equals a reduction of about 130 GB of network traffic for all users every day, or 47TB per year. The reduction of network traffic translates into a reduction of electricity use, thus, this change is also good for the environment. Additionally, the interdependencies between the modules were reduced from 4MB to 1MB, which improved the loading time per page as well.
Many thanks to everyone involved in this improvement! If you want to get more details about the actions we performed, you can have a look at the Phabricator board https://phabricator.wikimedia.org/project/board/4268/query/all/. If you are developing scripts or tools on top of the Wikidata UI, some documentation will walk you through the architecture of RessourceLoader https://www.mediawiki.org/wiki/ResourceLoader/Architecture, what’s page load performance https://www.mediawiki.org/wiki/Wikimedia_Performance_Team/Page_load_performance and how to create module bundles with ResourceLoader https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader.
For further questions or feedback, feel free to contact us on this page https://www.wikidata.org/wiki/Wikidata:Contact_the_development_team.
Cheers,
Max for the Wikidata team
wikidata-tech@lists.wikimedia.org