This is a minor bug which can be the first link of a chain which can affect performance significantly.
user module tries to load the file object of a user picture even if it's set to 0, which means no picture.
In general this doesn't cause any issue. If a website also has entitycache module caching file entities, and memcache module as the cache backend, then entitycache will try to get a non-existent file from the cache, and with high loads this could lead to memcache stampede protection kicking in too easily, leading to long waiting times for semaphore release.
A workaround is to disable user pictures.
This should be fixed in memcache too (and possibly handled somehow in entitycache), but fixing it here does not hurt.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3006007-2.patch | 688 bytes | marco |
Comments
Comment #2
marco commentedComment #3
poker10 commentedSeems like a good catch, thanks! In addition to memcache, this could hurt the performance especially if the site has lot of users, pictures are enabled, but most of users are without picture. And if the page is loading more users by user_load_multiple, then the generated entity query will be something like this:
Which is not optimal. Without these zeroes the performance of this query will be way way better. Proposed
array_filter()should solve the problem and use only FIDs which are not zero. +1 to this patch.Comment #4
mcdruid commentedThis looks like a nice simple fix / optimisation.
Adding a test might be nice, but as we're not fixing an actual error in vanilla core ("In general this doesn't cause any issue") it might not be trivial to do so.
I'm happy for this to be committed as it is.
Comment #6
poker10 commentedThanks all!