Re: APC & __autoload & webclusters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch schreef:
On Thu, February 21, 2008 9:27 am, Jochem Maas wrote:
1. __autoload & APC

I have been STW to try and find a definitive answer as to whether
using __autoload with APC
is a bad idea ... and if so why? ... I can't find that definitive
answer, can anyone here
state whether this it's an absolutely bad idea to use __autoload with
APC? (I need to
speed up an app that currently loads in pretty much everything on
every request ... and it's
impossible to untangle the class interdependencies, in the time I
have, and thereby load only
what is absolutely needed, when it's needed ... so I want to give
__autoload() a shot in order
to minimize what classes are loaded.

If it's that inter-tangled, then I would hazard a WILD GUESS that the
__autoload will still end up loading everything...

but not on every request ;-) ... I do use output caching, and I know
not everything is actually used in every request.

I'm being optimistic and hoping it has a marginally positive effective on
average request processing time.


2. webclusters & APC

I'm building a load-balanced cluster for the same app ... a certain
times new data is imported
from a thirdparty system after which some APC cached data needs to be
cleared, in the same vein
I occasionally roll out a new version and then the APC opcode cache
needs to be cleared (each webserver
in the cluster has it's own APC cache obviously).

now I'm stuck with the problem of how to trigger the cache clearance
on all servers ... Greg Donald
already mentioned the ruby based capistrano for executing commands on
multiple remote servers and I'll
be using that to manage things like cache clearance, webserver
restarting, etc on all the webservers

... BUT I have found that it is not possible to control the APC cache
of php_mod from the CLI version of
php, they apparently use different APC caches. it seems that the only
way to control the APC cache of
mod_php is via a web interface. APC ships with the very handy apc.php
script but this is hardly a decent
way of controlling/clearing the APC cache of multiple machine
programmatically.

Am I stuck with one of:

1. doing a graceful restart of all servers (which causes APCs cache to
disappear)?

Yes, that should work.

I know - but it's a rubbish solution because it offer no control as to what
is cleared from the APC cache, sometimes I want to clear opcodes, sometimes user-data,
sometimes both ... graceful means being forced to clear everything.


2. writing a cmdline script that performs a URL request to a copy of
apc.php that is reachable via each
webserver in order to clear/manage the APC cache?

Yes, but obviously password-protect it to avoid DOS.

yeah - think this is the route I have to take somehow .. I'm going to look into
running a seperate vhost only available via 127.0.0.1, with a pwd on it and then
write a little script that can control the apc cache via said vhost from the
cmdline ... the cmdline script would then be controlled remotely via ssh using
the coolness that is capistrano (http://www.capify.org/)


or is there another way that I can control the webserver's APC cache
from the cmdline?

One would think there would be some kind of USR_* signal that can be
sent through Apache to APC to clear cache...

One would think that there was something like this indeed - I cannot find it,
but then there must be something ... I assume, for instance, that Yahoo!** occassionally
see fit to clear APC caches on more than one machine and I doubt Rasmus sits there and
opens a browser to run apc.php on each one ;-)

** is it too early to say 'MicroHoo!' ?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux