Page MenuHomePhabricator

Cache SkinAfterBottomScriptsHandler::createSchemaElement
Open, Needs TriagePublic

Description

Currently, article pages contain the JSON-LD linked data schema at the bottom of the article page. Calling this method triggers two DB queries to fetch the description of the entity and the first revision of the article.

Building the JSON-LD schema takes around 5% of the request time for an article. (https://performance.wikimedia.org/excimer/profile/17c43b402fb432bb). We should look into caching the result of TermLookup::getDescription and RevisionLookup::getFirstRevision as there is no need to execute these every request.

image.png (993×2 px, 293 KB)

Event Timeline

Having a very quick look at what this is about, it seems SkinAfterBottomScriptsHandler::createSchemaElement was added in 2018 in Update: add Article schema to pages for SEO for T198946: Add Schema property 'sameAs' pointing to Wikidata entries. Adding caching here is probably fine, but we must be mindful to not add another vector for something like T269003.