Closed MPThLee closed 3 years ago
It is indeed possible to make a cache for doGetFileStat()
, and it would theoretically improve performance. It might not be sufficient for a page with 700 images to not timeout while rendering, though, since any non-cached queries would still be sent sequentially (it's MediaWiki core that decides when to call doGetFileStat
). But it should be an improvement.
That cache won't even have stale data (since we can invalidate it for some image A if/when that image is uploaded/deleted/renamed), except when there are 2+ webservers that don't share the same memcached server(s).
Well, I was starting to use S3 for backup and cdn purpose. As Images became bottleneck on server side by low iops when that time.
BTW, I'm using redis but it's ok, right? I don't know the behind of MediaWiki's cache system.
MediaWiki can indeed use Redis instead of Memcached. They do the same thing.
Please try the following version:
git clone -b cache-GetFileStat --depth 1 https://github.com/edwardspec/mediawiki-aws-s3.git AWS
... and let me know if it improves the situation.
This does a better performance than current master branch! 10~20 seconds are reduced. (Since sometime render does reaches 75 seconds depend on network status.)
PS. Can I set Cache TTL? 24 hours are ok but I want to cache live more.
Will probably just set TTL to 7 days. Since the cache is properly invalidated, it is never stale and TTL doesn't need to be short.
Pages with ~700 images might also benefit from $wgResponsiveImages = false;
(causes less thumbnails to be generated).
So, After using cache-GetFileStat
branch, The page almost got 37 seconds to render as cache hits more. (in Real time usage).
The page that I used is all low resolution(~700 images), 96px Square Card Icons, So it won't get a benefit from $wgResponsiveImages = false;
. Sadly.
Hi, It seems like it's related to MediaWiki bugs too. It checks 96px thumbnails of 96px images per each parse time :( (Same thing happens all times, It checks thumbnails of same size of original image) However, It's faster than without cache because valid responses are still cached properly I guess.
Merged. Thank you for suggesting this optimization.
If there's too many images(files) are in a page, The page rendering became very low, even Parsoid(Backend of VisualEditor) give up to parsing it. Why there's a too many images in a just one page? Well, Our wiki is some kind of card game wiki and We've page that collection of whole released cards in a one page.
The reason is, Because a bunch of
doGetFileStat()
is called, it blocking many things.The result makes Real-Time to over a minutes. (Info: Tested page has ~700 images with fixed 96px * 96px resolution)
$wgAWSLocalCacheDirectory
with low$wgAWSLocalCacheMinSize
value(1024
) didn't helped.(how about make aggressive local cache thingy?)