I've been trying to find information about it, and what I've pieced
together so far is that if you are running PHP as an Apache module, and
if you are making your own extension in C, then you get access to
methods that allow you to store stuff in some sort of shared memory in
the Apache process, that you can retrieve between pageviews, such as
socket handles or initialized arrays or similar. But there's nothing in
the PHP language itself to do something like that, you have to make your
own C module. Correct?

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.

Reply via email to