PHP memcached extension

Alex Stapleton alexs at advfn.com
Tue Sep 6 08:47:03 PDT 2005


On 6 Sep 2005, at 16:33, Russell Garrett wrote:

>
> On 6 Sep 2005, at 14:25, Alex Stapleton wrote:
>
>> Hi Russ ;)
>>
>> Very short timeouts and machine local status tables (in  
>> memcached / turckmmcache / eaccelerator / whatever you want ) seem  
>> to produce pretty reliable fail over for us. Throw in some  
>> timeout's and register_shutdown_functions()s to recheck the server  
>> periodically and it actually starts to get pretty nice.
>>
>> As long as your connect() time-out is low enough to merely make it  
>> look like the page took slightly longer than normal to load, you  
>> shouldn't have anything to worry about. It means you have a higher  
>> potential for false positives but we haven't had any of those yet  
>> with our time-out set to 500 ms.
>>
>> Even if you use something which has a habit of forgetting about  
>> keys (e.g. turck) it's not too painful as the failed connection  
>> attempt ratio still tends to stay low enough to not be  
>> particularly noticeable.
>
> It *is* you...
>
> No chance on going open-source on your code then? Or I'll have to  
> do it myself... Someone's got to do it sooner or later.
>
> I was somewhat resigned to doing it myself in the end, but I  
> completely forgot about eaccelerator as a means of local shared  
> memory.
>
> I'm certainly not going back to a libmemcache-based solution in a  
> hurry after the amount of grief it's caused me over the various  
> times I've tried it.
>
> Russ
> russ at last.fm

Of course it's me :P

Currently we aren't using memcached in production but we are planning  
to shift some stuff onto it soon. We use that technique to get around  
having to use the (generally crap and ancient) F5 load balancers
which have been in use for eon's because someone didn't think about  
the bottleneck it might cause. I see no reason why it wouldn't work  
for memcached though. So no, I don't have any memcached code that I  
could open source.

apr_memcached looks good. I've not used it though. I believe SWIG has  
some vague PHP support these days, so that might make life a bit  
lazier too. Personally I think the best solution is probably sticking  
with your existing code for now and extending it with PHP as much as  
you can. Unless your getting crap performance from your PHP code, in  
which case I don't see anything wrong with just enhancing the PECL  
module to whatever your PHP code looks slowest. It's not like a bit  
of C is beyond your abilities ;)

Considering maintaining the server list turned out to be about 30-40  
lines of code at most, it's really not a big deal to implement. I can  
probably rip out the relevant bits and e-mail them to you for  
inspiration if you want? It's probably bugged anyway, so some fresh  
eyes would do it good.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20050906/d1222feb/attachment.html


More information about the memcached mailing list