motorcity Posted May 1, 2011 Share Posted May 1, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/ Share on other sites More sharing options...
gizmola Posted May 1, 2011 Share Posted May 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1208872 Share on other sites More sharing options...
motorcity Posted May 1, 2011 Author Share Posted May 1, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1208877 Share on other sites More sharing options...
gizmola Posted May 1, 2011 Share Posted May 1, 2011 What is the eviction rate? Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1208880 Share on other sites More sharing options...
motorcity Posted May 1, 2011 Author Share Posted May 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1208979 Share on other sites More sharing options...
gizmola Posted May 1, 2011 Share Posted May 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1209151 Share on other sites More sharing options...
motorcity Posted May 2, 2011 Author Share Posted May 2, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1209242 Share on other sites More sharing options...
gizmola Posted May 2, 2011 Share Posted May 2, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235236-using-memcached-for-url-rewrite-~-evaluation/#findComment-1209524 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.