Page MenuHomePhabricator

Review the performance implications of MediaWiki:Pagecategories on the English Wikipedia
Closed, ResolvedPublic

Description

MediaWiki:Pagecategories was created by Midom in 2008 with the edit summary "the rare occurrence of singular 'category' adds few milliseconds to page load :)" (this was deleted a few months later, only to be recreated by Masem in 2009). This was also communicated in the Signpost at the time:

There were other related miscellaneous changes such as changing MediaWiki:Pagecategories from the default {{PLURAL:$1|Category|Categories}} to just Categories; on a wiki as large as the English Wikipedia, and for a message that needs to appear on most pages, this actually makes a significant difference.

Whether this micro-optimization was still needed was questioned in 2016 on the talk page, to which @Nikerabbit replied with "[m]y guess is that this is less of an issue nowadays, but I am not able to say for sure."

It has been six years since the talk page discussion, and 14 years since the original change; in that time, PHP, MediaWiki, and the WMF server infrastructure have changed a lot. Is this optimization still needed? Even if it has the same absolute impact now (which I doubt) as it did in 2008 (a "few milliseconds"), is that still as significant a concern? Or can this page be deleted now, restoring the default message? Should I simply BOLDly delete it myself and see what the fallout is? (:

Event Timeline

Looks like this also applies to MediaWiki:Hidden-categories, created at the same time by Midom.

Krinkle updated Other Assignee, removed: Krinkle.
Krinkle triaged this task as Medium priority.Dec 12 2022, 6:59 PM

I analysed this locally by creating two otherwise blank pages, one with 1 category, and one with 2 categories. The default behavour for the category footer is indeed to pluralise the interface text as "Category" or "Categories" respectively, using {{PLURAL:}} in wikitext.

I measured the HTTP latency with mostly default settings and no debug/dev settings by loading each page 10 times in Firefox (after a warmup request for caches, no browser caching). Then I loaded it three more times with tracing enabled via php-excimer and this MediaWiki-Docker recipe), and chose the result with median total latency.

HTTP latencyTrace % of Skin::getCategoryLinks
Optimised126, 126, 133, 135, 149, 142, 151, 153, 154, 1580.33% (5 of 1522 x 0.1ms samples)
Default121, 124, 127, 132, 132, 133, 137, 138, 151, 1580.62% (10 of 1601 x 0.1ms samples)

I decided this was inconclusive, messy, and I should just test it in production. Using the mediawiki.org sandbox (revision), and ApacheBench on mw1352.

Relevant guides on Wikitech:

Default - before
krinkle@mw1352:~$ ab -n 500 -c 24 -l -H 'Host: www.mediawiki.org' 'https://mw1352.eqiad.wmnet/wiki/Project:Sandbox'
[…]
TLS Server Name:        www.mediawiki.org
Document Path:          /wiki/Project:Sandbox
Document Length:        Variable
Concurrency Level:      24
Time taken for tests:   23.971 seconds
Complete requests:      500
Failed requests:        0
Time per request:       1150.601 [ms] (mean)

Percentage of the requests served within a certain time (ms)
  50%   1132
  66%   1137
  75%   1141
  80%   1143
  90%   1149
  95%   1155
  98%   1162
  99%   1167
 100%   1178 (longest request)
Optimised - after
krinkle@mw1352:~$ ab -n 500 -c 24 -l -H 'Host: www.mediawiki.org' 'https://mw1352.eqiad.wmnet/wiki/Project:Sandbox'
[…]
TLS Server Name:        www.mediawiki.org
Document Path:          /wiki/Project:Sandbox
Document Length:        Variable
Concurrency Level:      24
Time taken for tests:   23.988 seconds
Complete requests:      500
Failed requests:        0
Time per request:       1151.416 [ms] (mean)

Percentage of the requests served within a certain time (ms)
  50%   1132
  66%   1138
  75%   1141
  80%   1143
  90%   1151
  95%   1156
  98%   1163
  99%   1167
 100%   1174 (longest request)

I could not find a measurable difference one way or the other. I'd say, @Dinoguy1000 feel free to remove either or both of these overrides to Pagecategories and Hidden-categories.