Topic on Project:Support desk

Instant commons not working with file cache

5
Buster2223 (talkcontribs)

I have a wiki with a few thousand articles. When I started using the file cache to improve performance, the images from Instant Commons began breaking. I looked into how this could be happening and read that somewhere along the line Instant Commons stopped storing local copies of images on the wikis that use them. Am I understanding this correctly? I thought the original idea was to share images with attribution info without putting undue load on WMF's servers.

Long story short I need a workaround that will make the file cache work with InstantCommons. I'd really rather not have to install Varnish because it would be just one more thing that could fail, but I can if that's the only way.

I suspect I would not even need to mess with this caching business if InstantCommons had not changed the rules in the middle of the game. My pages with all text or local images load very quickly.

Bawolff (talkcontribs)

> somewhere along the line Instant Commons stopped storing local copies of images on the wikis that use them. Am I understanding this correctly? I thought the original idea was to share images with attribution info without putting undue load on WMF's servers.

Storing them locally caused significant latency on the client wiki, at the same time, the server load to WMF for hotlinking was pretty minimal, so we changed the defaults. You can still use the old way by configuring it in $wgForeignFileRepos. Note, this change happened a little while ago, and it depends on what version MediaWiki you have, so the behaviour would only change if you updated your version of MediaWiki.

I'm not sure why FileCache would be interfering with this. I would expect filecache to work with either version of instant commons. What exactly happens? Does MediaWiki just think the image doesn't exist?

Buster2223 (talkcontribs)

Thank you for the reply. We're running 1.35.0. When File Cache is enabled, many of the images show a red link instead of a thumb. Clicking on the red link brings you to the file upload screen. So yes, it looks like MediaWiki thinks the image does not exist.

Buster2223 (talkcontribs)

Thank you Bawolff for the tip. I think it is working now. Hopefully links don't start breaking in a few days. I disabled InstantCommons in LocalSettings.php and inserted the code from here: Manual:$wgForeignFileRepos#Using files from Wikimedia Commons : ForeignAPIRepo. Now when you right click a thumb and open in a new window the thumb location is on my site instead of Wikimedia.

There is a good speed boost even without file caching. Something is slow with Wikimedia's thumb hotlinking service.

Tinss (talkcontribs)

I configured ForeignFileRepos manually but it somewhat made things worse. First page loads are super slow, once everything is cached, things seem faster but after a certain delay it as if nothing was ever kept server side and loading is slow again.

As stated in Manual:$wgUseInstantCommons, it probably has to do with an hardcoded TTL of 3600s when metadata is fetched.

Reply to "Instant commons not working with file cache"