Imageinfo queries involving extended metadata for tens of images are very slow; for hundreds, they time out. Is something wrong here? Is caching working correctly? How can it be improved?
Reasons I can think of off the top of my head:
- Some other part of the imageinfo API is slow. (extmetadata is cached via FormatMetadata::fetchExtendedMetadata() but the API call itself is not.)
- FormatMetadata::fetchExtendedMetadata() itself is slow. It has dynamic cache invalidation (even if it is a cache hit, the ValidateExtendedMetadataCache hook gets invoked) so while unlikely it is not impossible.
- Some broken ValidateExtendedMetadataCache hook. (A bug in this recent patch, for example.)
- The cache (correctly) getting invalidated all the time due to frequent edits coming from SDC. (Theoretically, a change in the structured data shouldn't invalidate it, but this is pre-MCR code and not slot-aware.)
- Some bug affecting the caching logic (e.g. File::getDescriptionTouched() broke).
If the problem can be reliably reproduced, maybe profiling via X-Wikimedia-Debug could pin it down.
Also, the cache expiration is 30 days, so a request involving lots of cache misses would not be that unusual. The API should probably be modified to limit the number of uncached extmetadata lookups and force continuation when the limit is reached.