On 10/28/2012 08:04 AM, Ángel González wrote: > El 28/10/12 14:52, Rasmus Lerdorf escribió: >> On 10/28/2012 04:54 AM, Terry Ellison wrote: >> >>> From the perspective of a production sysadmin, I've always just set >>> apc.stat=0 but then cleared the cache following any change. This gives >>> the best of both worlds: the performance dividend of no stat'ing and >>> avoiding the weird gremlins that sometimes occurred if I didn't flush >>> the cache. The one-off hit for repriming the cache again is pretty >>> small and the "release from dev to live" cycle isn't a common event. >>> For a multi-app configuration, it would be a very simple matter to write >>> an admin script which clears the cache based on some REGEX filename >>> match, so that this could be integrated into application release scripts. >> This causes deploy race conditions though. You want requests that are >> already in progress right when the deploy happens to continue executing >> with all the old versions of the scripts. The PHP realpath cache helps >> here. If you clear out the opcode cache on the deploy you end up with >> these requests all picking up the new version mid-request. >> >> -Rasmus > Don't you already have the same race condition for requests in progress > when atomically replacing the docroot?
Nope, because the PHP realpath cache will provide the info from the previous docroot until you clear it, so you only clear that cache at the top of a new request. That allows all existing requests to finish on the previous codebase. > IMHO it would be appropiate for APC to delay the cache flush until all > running requests have finished (and obviously not starting any new one > with the old cache). That's impossible. APC has no concept of a request and can't in any way enforce that. That's something that happens at the web server level. > If you instead perform a graceful restart of apache, I think that would > reset the > APC cache, and the apache itself makes the new requests isolated from > the old > ones. And I don't want a graceful either. I want to reuse cached entries for files that haven't changed across deploys. For CI where you might potentially deploy hundreds of times a day, wiping your entire cache every time you deploy a minor change really sucks. -Rasmus -- PECL development discussion Mailing List (http://pecl.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
