Currently, users can set any thumbnail sizes in mediawiki and we will serve them the exact same size. This has caused many issues: {T211661} {T345334} and many more tickets connected to them.
A rather simple improvement to this is to expand pregen sizes (in mw) and when users set the thumbsize when editing (e.g. if she picks 110px), we pick the smallest thumbsize that's larger than the picked size (in this case: 120px). Set the image URL to that size but resize the `<img>` tag to the requested size (110px in this example).
For what pregen sizes we can pick, here are some data of most used sizes:
|cache status|size (px)|hits (in a day)
|------|-----|-----
|hit-front|220|155602049
|hit-front|440|135746095
|hit-front|40|111905238
|hit-front|160|97151635
|hit-front|20|95060013
|hit-front|23|93020718
|hit-front|60|82391195
|hit-front|960|77506680
|hit-front|30|70646190
|hit-front|120|68306081
|hit-front|45|53407704
|hit-front|330|49912716
|hit-front|22|49074909
|hit-front|300|48777979
|hit-front|44|48309778
|hit-local|220|48146954
|hit-front|46|47160522
|hit-front|50|44400026
|hit-front|35|43559169
|hit-local|440|43416242
|hit-front|200|41122192
|hit-front|188|39760280
|hit-front|480|33331526
|hit-local|160|33202649
|hit-local|120|32572116
|hit-front|15|31546759
|hit-front|100|30324205
|hit-local|330|28760556
|hit-front|500|27901900
|hit-front|150|26586327
We don't need to change anything in swift/thumbor/ATS/varnish/etc. but it will reduce a lot of cache fragmentation and load on thumbor and storage on swift. It'll improve user experience by serving more from edge caches than backends.
This probably should be rolled out gradually and wiki by wiki (by a config flag)