Last modified: 2010-05-15 15:33:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T3686, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1686 - Image metadata cache is needed to avoid multiple file operation
Image metadata cache is needed to avoid multiple file operation
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.4.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-11 06:59 UTC by Andrius Ramanauskas
Modified: 2010-05-15 15:33 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Changes in Image.php and SpecialUpload.php files (3.25 KB, patch)
2005-03-11 07:03 UTC, Andrius Ramanauskas
Details
A better fix (8.87 KB, patch)
2005-03-11 11:15 UTC, Andrius Ramanauskas
Details
Fix merged into 1.4 branch (9.23 KB, patch)
2005-03-17 16:43 UTC, Andrius Ramanauskas
Details

Description Andrius Ramanauskas 2005-03-11 06:59:55 UTC
Currently image metadata is retrieved every time image apears on the page, so
file operations (file_exists, getimagesize) are called too often.
Image metadata cache can hold this information and reuse it every time when needed.
Comment 1 Andrius Ramanauskas 2005-03-11 07:03:07 UTC
Created attachment 364 [details]
Changes in Image.php and SpecialUpload.php files

Changes in Image.php sets metadata to cache on first use an retrieves on next
uses.
Changes in SpecialUpload.php deletes metadata on image upload
Comment 2 Brion Vibber 2005-03-11 08:01:21 UTC
We'll want to move metadata into the image tables for 1.5, but 
this might be a helpful hack for 1.4 for the meantime. A few 
comments:

If you can post diffs in -u format that'd be helpful; these are more 
legible (including context) and are easier to apply to modified 
files.

Use tabs for indentation to keep consistency with existing code.

Memcached has a key length limit of 255 bytes; we have a title 
limit of 255 bytes. A long image name thus may not fit; consider 
using a hashed name in the key.

It might be best to explicitly support the shared image source 
directory (commons); for instance by checking two memcached 
keys (shared and local).

Does this interact correctly with generated thumbnails? What 
about image deletions and reversions?

Remember to remove your test 'echo's before submitting patches. 
:)

The [$i++] stuff is somewhat opaque; consider using a dictionary. 
($cachedValues = array( 'name' => $this->name, ... )
Comment 3 Andrius Ramanauskas 2005-03-11 11:15:45 UTC
Created attachment 365 [details]
A better fix

Removed echos (shame for me for leaving those :), tabified, implemented cache
invalidation on delete/undelete/revert, better support of commons
Comment 4 Andrius Ramanauskas 2005-03-11 11:24:26 UTC
(In reply to comment #2)
> <..>
> Does this interact correctly with generated thumbnails? What 
> about image deletions and reversions?
> <..>

It does show thumbnails correctly, so I guess that it should not impact them
anyway (except that original image is not accessed for metadata retrieving).
However, there are few file_exists calls for thumbnails, but I'm not sure I know
enough about thumbnail lifetime to add some caching here.
Comment 5 Tim Starling 2005-03-13 15:05:44 UTC
This is committed to HEAD, it really should be backported to REL1_4. The
severity of this bug is "enhancement" but actually it's the major performance
problem in Wikipedia at the moment, apparently causing frequent timeouts. 
Comment 6 Zigger 2005-03-13 16:41:44 UTC
(In reply to comment #5)
Set Version & Keywords accordingly.

Comment 7 Andrius Ramanauskas 2005-03-17 16:43:36 UTC
Created attachment 369 [details]
Fix merged into 1.4 branch

Merger same fix (with Tim's adjustments) into 1.4 branch
Comment 8 Antoine "hashar" Musso (WMF) 2005-03-27 19:42:50 UTC
merged

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links