T
will this
slow down a lot of the key hashing part of memcache
as well as the
initialization of the client when we loop to add servers..
http://us2.php.net/manual/en/memcached.construct.php
or
http://us3.php.net/manual/en/function.memcache-addserver.php
depending on your library.
Brian.
Yeah. special PHP mumbo jumbo.
> And that then, in turn, means that the answer to the original question is that adding more servers doesn't slow down the app, if they're using persistent connections, because client initialization will
> only happen once? (Given the prerequsities above, and given that they actually make sure they only init once like a comment on that memcached manual page describes)
>
> And is this true for both PHP clients?
I recall a thread a while back that the ketama/consistent hashing stuff
with the old library redid all of the calculations on every request
regardless of persistent settings.
Don't recall if that was ever fixed or properly tested, but the
complaining user had his performance problems go away when he stopped
using that.
I assume pecl/memcached isn't quite that stupid, but someone might want to
verify for PHP's sake.
-Dormando
Right, PHP is meant to do all complicated things or heavy lifting in C,
not PHP. It is the PHP way despite people not doing it that way every day.
> And that then, in turn, means that the answer to the original question
> is that adding more servers doesn't slow down the app, if they're using
> persistent connections, because client initialization will only happen
> once? (Given the prerequsities above, and given that they actually make
> sure they only init once like a comment on that memcached manual page
> describes)
>
> And is this true for both PHP clients?
I don't really know what this has to do with slowing down the app. Are
you seeing some problem or issue you are trying to resolve or being
academic? Persistent connections happen once per PHP process provided
the SAPI in use allows for storage across requests. But, if you are
using Apache and you have MaxClients at 250 and it gets there, you will
have 250 connections to memcached. If you want to reduce that, you could
use something like Moxi to pipeline those connections. But, again,
knowing what your problem is and why you are so worried about it would
help us help you.
As for pecl/memcache, just don't use it. It needs a lot of work and the
authors don't seem interested.
Brian.