[buddypress-trac] [BuddyPress Trac] #1332: Caching issues with profile data when using a persistent cache
buddypress-trac
noreply at wordpress.org
Tue Feb 4 13:57:14 UTC 2014
#1332: Caching issues with profile data when using a persistent cache
--------------------------+------------------
Reporter: swinton | Owner:
Type: defect (bug) | Status: new
Priority: major | Milestone: 2.0
Component: XProfile | Version:
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------
Comment (by DJPaul):
Yes. I should first say my (limited) experience is based around using
Memcached as the object caching backend. It's possible that other object
caches might behave differently, I don't know.
Actually, groups don't make invalidation any easier[0]; it's not possible
to delete all items in a group. This is why sometimes you see
`wp_cache_incr()` function used to help build a cache key name. If you
have a bunch of items that rely on one common other thing and you need all
the items to be invalidated/deleted at the same time, `wp_cache_incr()`
helps: you're never explicitly telling the object cache to delete a bunch
of items, instead you're telling the object cache to fetch/set against a
new key.
The data stored against the old key is ignored/not used by your
application and is eventually removed by the object cache purging old data
in least recently used (LRU[1]) order.[2]
I'm reliably informed that, namespacing benefits aside, all groups really
do is make it easier to distribute cached data across multiple servers.
For example, you could optimise your infrastructure by having "expensive
but not hot" data stored in a separate (object caching) server; this will
help avoid LRU purging that you might get in a pool of servers that have a
lot of cache writes, in turn causing more of the expensive DB queries that
you're caching against in the first place.
For memcached specifically, there is also a maximum cache bucket (aka
group) size of 1MB. If the bucket size exceeds 1MB, everything is dropped.
Hopefully we aren't going to storing or fetching a whole megabyte from
cache because if we do, we're probably doing something wrong :)
[0] http://scotty-t.com/2012/01/20/wordpress-memcached/
[1] http://stackoverflow.com/questions/10122384/memcache-and-expired-items
[2] Unless you set an expiry on a particular item, of course.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/1332#comment:11>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list