Does anybody possess a great system, or any ideas, for doing because the title states?
I wish to switch production version of web application-- designed in PHP and offered by Apache-- from release 1234 to produce 1235, before that occurs, have files already within the opcode cache (APC). Then following the switch, take away the old cache records for files from release 1234.
So far as I'm able to think about you will find three easy methods for atomically switching in one version to another.
- Possess a symbolic link, for instance /live, that's always the document root but is transformed to suggest in one version to another.
Similarly, possess a directory /live that's always the document root, but use
mv live oldversion &lifier&lifier mv newversion live
to change to latest version.
- Edit apache configuration to alter the document root to newversion, then restart apache.
It is more suitable not have to complete 3, however i can't think about anyway to precompile all php files And employ one or two to change release.
So can someone either convince me its okay to depend on option 3, or let me know working with one or two, or reveal another option I'm not considering?
Then following the switch, take away the old cache records for files from release 1234.
You are able to only obvious the whole cache or none whatsoever. It isn't a selective process. This might improve your method of the issue. If precompilation is vital you might be instructed to bring lower the server throughout the switchover.
Precisely why would you like to do that?
After I switch to a different release, I simply stop my Apache, replace the PHP files around the server via checkout from the VCS and restart Apache. It mostly takes under thirty seconds to drag this off, it's even scriptable. All that's performed at any given time when you will find couple of or no customers. Next, the opcode cache is empty and can fill itself the moment someone uses the files.
Maybe the very first couple of hits won't have optimal performance but that shouldn't be so bad. On my small production systems nobody ever observed this short performance drop. And you will find some really heavy load systems included in this.
You may also place an easy "improving ... return soon" screen in your server while changing the files to prevent any disturbing error messages for your customers.