There's currently no diagnostic UI for APC. Trim down a version of apc.php that doesn't expose cache keys or cache content.
Description
Revisions and Commits
rP Phabricator | |||
D12319 | rP2a3783cd2c2b Suggest "apc.slam_defense" off and "apc.write_lock" on | ||
D12318 | rPffe9c26b00f0 Emit cache setup issues from cache specs | ||
D12317 | rP4783c3940d00 Summarize data cache usage and allocation information | ||
D12316 | rPc5d38c6e08f9 Provide more information about cache sizing in cache diagnostics | ||
D12315 | rP0880788bd4cf Restructure cache checks to improve modularity | ||
D12314 | rPc6b05dbb63a1 Add a very basic cache status page |
Related Objects
Event Timeline
I merged T4080 here because my half-diff of this ended up covering a lot of the territory there anyway.
Support Impact APC/OpCache have a dramatic impact on performance but are not straightforward to configure correctly.
APC is mostly-dead for php >= 5.4, and OpCache is "core" and "supported" for php >=5.5.
Being "core" and "supported" only seems to mean "The code is in there, and it builds and it's possible to get it work if you're lucky and know the right spells", because it builds an .so file and puts it in a random place, and doesn't try to load it.
I got my build-from-source-script to work it (for php 5.5.18) by adding this post-build steps:
cd $INSTALL_ROOT # Wherever 'make install' put php mv lib/php/extensions/*/*.so lib/php/extensions/ # In my config, this is just one file, opcache.so rmdir lib/php/extensions/* echo "zend_extension = $PREFIX/lib/php/extensions/opcache.so" >> etc/php.ini
And that's about it. No special arguments for ./configure, and the default config is "use for http mode, do not use for cli".
My Phabricator instance started going really slow. The Dark Console revealed that all the configuration checks were running with every page load (e.g. git checks, pygments, etc). Further investigation showed that the APC was not working. After some helpful tips from @epriestley, I was able to fix it. Here's the blurb I added to my php.ini:
; NOTE(keir mar 5/2015): APC seems to have broken on PHP 5.3.0; error messages: ; ; [Fri Mar 06 01:26:21 2015] [error] [client 63.232.3.122] #8 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19] ; [Fri Mar 06 01:26:21 2015] [error] [client 63.232.3.122] [2015-03-05 17:26:21] ERROR 2: apc_store(): Potential cache slam averted for key 'phabricator.setup.needs-repair' at [/home/ubuntu/phabricator/libphutil/src/cache/PhutilAPCKeyValueCache.php:36] ; ; Suggested solution from: ; http://stackoverflow.com/questions/4983370/php-apc-potential-cache-slam-averted-for-key ; ; I used this script to figure out that it didn't work, under phabricator/support/debug.php which appeared as phabricator.locu.com/debug/ ; ; <?php ; error_reporting(E_ALL | E_STRICT); ; $key = "i_am_a_banana"; ; echo "\nFetching: " . apc_fetch($key) . "\n"; ; echo "Storing: " . apc_store($key, "yes i am") . "\n"; ; apc.write_lock = 1 apc.slam_defense = 0
This seems to be in relatively good shape. Some possible future work:
- Offer advice on user cache sizes?
- PHP 5.6 may make this even more complicated?