Jump to content

Using memcached for url rewrite ~ evaluation


motorcity

Recommended Posts

Hello,

I started using memcached about 2 1/2 months ago. It's being used to do url rewrite and cache the results.

I'm using http://pecl.php.net/package/memcache to monitor what's going on.

These are pretty typical results;

hits = 40.6%

misses = 59.4%

free = 32.5%

used = 67.5%

I'm on a pretty good vpn with a huge database and moderate to low traffic.

Any thoughts on this?

 

Link to comment
Share on other sites

I"m not sure what type of feedback you're looking for.  Usually people use memcache to cache database query results in memory.  Url's sound like a small set of data, so it's hard to understand why the cache hit rate wouldn't be higher over time.

Link to comment
Share on other sites

My thinking right along has been expecting much better hit to miss ratio.

I'm currently reporting

request rate (hits. misses) = .21 cache requests/second

hit rate = .09 cache requests/second

miss rate= .13 cache requests/second

set rate = .13 cache requests/second

 

Cache used = 43.2MBytes

Cache size = 64MBytes

 

Do I increase the cache size? Or something else?

Link to comment
Share on other sites

Using the program noted above clicking on "variables" it lists by slab;

Item count, Age, Evicted

I find 21 slabs which vary from item counts of 1 to as many as 12000.

Also quite random is the age, anywhere from a day to multiple weeks. (current uptime is 2 weeks).

Every slab has "No" for evicted.

 

Shorter answer, I don't find a rate for eviction.

 

 

Link to comment
Share on other sites

If items aren't being evicted, then the cache is not filled.  So the answer seems to be that whatever routines are adding items to the cache, and checking the cache are not finding a match in the cache 60% of the time.

Link to comment
Share on other sites

That sounds so logical that it almost hurts.

Thanks. ~for the confirmation.

I'm going back to the author of this code. Been meaning to for awhile.

I'll post back here if anyone is interested.

Obviously memcache is a fairly rare bird, and issues with it are even more rare.

Link to comment
Share on other sites

The rank and file php programmer who only does small sites might not use memcache, but for larger sites, it's heavily used.  It's also extremely simple, consisting aside from connections of literally two functions... set() and get().  Set is pretty much set('key', 'value') where typically a key might be something like:  '/foo/bar/something/'.  In other words the structure of the key can be whatever you want, but it's vital that the routine that tries the get() has a matching key, or you may end up looking for cache entries that are there, but never get found because of some problem in the way the key was generated.  You could probably do some analysis yourself and look for the memcache routines in the code you have.  Good luck.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.