PECL memcache extension
Don MacAskill
don at smugmug.com
Sat Mar 11 01:50:49 UTC 2006
BTW, for those who might be curious, we're seeing a 50% reduction in
total script execution time using the PECL extension on
moderate-to-heavy memcache pages (pages which have lots of memcached
interaction) versus our PHP class (which was reasonably well optimized
already, given how critical memcached is to us). On light pages (those
without too may queries), the difference isn't nearly as great, of course.
One interesting point is that's for total script execution - and
obviously we're not spending 100% of the execution time fetching data
from memcached, so the actual calls are something greater than 2X. If I
get time, I'll see if I can narrow down exactly what the multiple we're
seeing is.
Interestingly, we're not noticing much difference between persistent and
non-persistent using the PECL client. Seems to be well under 10%. I
suppose it's building connections so quickly there's not much noticeable
difference? Anyway, for those who are having persistent problems, you
might profile your app with it off.
I'll send more data as I get it, once this bug is fixed (or I'm fixed,
if I'm doing something dumb :).
Don
Don MacAskill wrote:
>
> Brian Moon wrote:
>> Don MacAskill wrote:
>>>
>>> Hi Mikael,
>>>
>>> I'm getting a segfault when a server fails and I try to set status.
>>> Example code:
>>>
>>> $memCache = new Memcache();
>>>
>>> $memCache->addServer("192.168.0.1", "10000", 1, 1, 1, 15, true,
>>> 'memcacheFailCallback');
>>> $memCache->add("test", "value");
>>>
>>> function memcacheFailCallback($Host, $Port) {
>>> global $memCache;
>>> $memCache->setServerParams($Host, $Port, 1, -1, false,
>>> 'memcacheFailCallback');
>>> }
>>
>> I don't know exactly how that call back works, but it looks like that
>> if $memCache->setServerParams fails, you could have an endless recursion.
>>
>> I could be wrong.
>>
>
> I don't think so, since if I have trigger_error() calls in there, I only
> see one call before it segfaults, not lots like it's recursing.
>
> Regardless, this code also segfaults:
>
>
> $memCache = new Memcache();
>
> $memCache->addServer("192.168.0.1", "10000", 1, 1, 1, 15, true,
> 'memcacheFailCallback');
> $memCache->add("test", "value");
>
> function memcacheFailCallback($Host, $Port) {
> global $memCache;
> if(!$memCache->getServerStatus($Host, $Port)) {
> trigger_error("setting off");
> $memCache->setServerParams($Host, $Port, 1, -1, false,
> 'memcacheFailCallback');
> }
> }
>
> And it should catch failed servers and not try to set them as failed
> again, if the callback worked that way. (Again, it doesn't appear to).
>
> Thanks for mentioning it, though. I could have easily overlooked that
> possibility.
>
> Don
>
More information about the memcached
mailing list