diff --git a/admin_manual/configuration_server/caching_configuration.rst b/admin_manual/configuration_server/caching_configuration.rst index 5a1eee662..2e97f9799 100644 --- a/admin_manual/configuration_server/caching_configuration.rst +++ b/admin_manual/configuration_server/caching_configuration.rst @@ -4,18 +4,19 @@ Configuring Memory Caching You can significantly improve your ownCloud server performance with memory caching, where frequently-requested objects are stored in memory for faster -retrieval. There are two types of caches to use: PHP opcache, and data caching -for your Web server. If you do not install a memcache you will see a warning on -your ownCloud admin page. (A memcache is not required and you may ignore the warning if you prefer.) +retrieval. There are two types of caches to use: a PHP opcode cache, which is +commonly called *opcache*, and data caching for your Web server. If you do not +install a memcache you will see a warning on your ownCloud admin page. (A +memcache is not required and you may ignore the warning if you prefer.) A PHP opcache stores compiled PHP scripts so they don't need to be re-compiled -every time they are called. PHP bundles an opcache since version 5.5, so you -don't need to install or configure it. +every time they are called. PHP bundles the Zend OPcache in core since version +5.5, so you don't need to install an opcache. If you are using PHP 5.4, which is the oldest supported PHP version for ownCloud, you may install the Alternative PHP Cache (APC). This is both an opcache and data cache. APC has not been updated since 2012 and is essentially -dead, and PHP 5.4 is very old and lags far behind later releases. If it is possible +dead, and PHP 5.4 is old and lags behind later releases. If it is possible to upgrade to a later PHP release that is the best option. Data caching is supplied by the Alternative PHP Cache, user (APCu) in PHP @@ -51,24 +52,11 @@ APC APC is only for systems running PHP 5.4 and older. The oldest supported PHP version in ownCloud is 5.4. -.. note:: RHEL 6 and CentOS 6 ship with PHP 5.3. See :doc:`php_54_installation`. +.. note:: RHEL 6 and CentOS 6 ship with PHP 5.3 and must be upgraded to PHP + 5.4 to run ownCloud. See :doc:`php_54_installation`. -This example installs APC on Red Hat/CentOS/Fedora systems running PHP 5.4:: - - yum install php-pecl-apc - -This example install APC on Debian/Ubuntu/Mint systems running PHP 5.4:: - - apt-get install php-apc - -After installing APC you must restart your Web server. This example restarts -Apache on Red Hat/CentOS/Fedora systems:: - - systemctl restart httpd.service - -This example restarts Apache on Debian/Ubuntu/Mint systems:: - - service apache2 restart +On Red Hat/CentOS/Fedora systems running PHP 5.4, install ``php-pecl-apc``. On +Debian/Ubuntu/Mint systems install ``php-apc``. Then restart your Web server. After restarting your Web server, add this line to your ``config.php`` file:: @@ -79,25 +67,12 @@ Refresh your ownCloud admin page, and the cache warning should disappear. APCu ---- -PHP 5.5 and up includes an opcache, so you don't need to install or configure -it. However, it does not bundle a data cache. APCu is a data cache, and it is -available in most Linux distributions. This example installs APCu on Red -Hat/CentOS/Fedora systems running PHP 5.5 and up:: - - yum install php-pecl-apcu - -This example install APC on Debian/Ubuntu/Mint systems running PHP 5.5 and up:: - - apt-get install php5-apcu - -After installing APCu you must restart your Web server. This example restarts -Apache on Red Hat/CentOS/Fedora systems:: - - systemctl restart httpd.service - -This example restarts Apache on Debian/Ubuntu/Mint systems:: - - service apache2 restart +PHP 5.5 and up includes the Zend OPcache in core, and on most Linux +distributions it is enabled by default. However, it does +not bundle a data cache. APCu is a data cache, and it is available in most +Linux distributions. On Red Hat/CentOS/Fedora systems running PHP 5.5 and up +install ``php-pecl-apcu``. On Debian/Ubuntu/Mint systems install ``php5-apcu``. +Then restart your Web server. After restarting your Web server, add this line to your ``config.php`` file:: @@ -105,6 +80,22 @@ After restarting your Web server, add this line to your ``config.php`` file:: Refresh your ownCloud admin page, and the cache warning should disappear. +.. finish this later. too vexing to bother with now. +.. Enabling PHP opcache +.. ^^^^^^^^^^^^^^^^^^^^ +.. +.. Use :ref:`label-phpinfo` to see if your PHP opcache is already enabled by +.. searching for ``opcache.enable``. If it says ``on`` then it is enabled and +.. you don't need to do anything. Figure 1 is from Linux Mint 17; the Zend +.. OPcache is enabled by default and ``phpinfo`` displays status and statistics. +.. +.. .. figure:: images/cache-1.png +.. :alt: The Zend OPcache section displays opcode cache status and statistics. +.. +.. *Figure 1: Zend OPcache status in phpinfo* +.. +.. If it is not enabled, then go into + Memcached --------- @@ -114,25 +105,23 @@ with :doc:`Transactional File Locking <../configuration_files/files_locking_tran store locks, and data can disappear from the cache at any time (Redis is the best for this). -Setting up Memcached is easy. This example shows how to install it on -Debian/Ubuntu/Mint:: +Setting up Memcached is easy. On Debian/Ubuntu/Mint install ``memcached`` and +``php5-memcached``. The installer will automatically start ``memcached`` and +configure it to launch at startup. - apt-get install memcached php5-memcached - -This example shows how to install and launch it on Red Hat/CentOS/Fedora:: - - yum install memcached php-pecl-memcached - systemctl enable memcached - systemctl start memcached +On Red Hat/CentOS/Fedora install ``memcached`` and +``php-pecl-memcached``. It will not start automatically, so you must use +your service manager to start ``memcached``, and to launch it at boot as a +daemon. -You can verify that the Memcached daemon is running with ``ps``:: +You can verify that the Memcached daemon is running with ``ps ax``:: - ps ax |grep memcached + ps ax | grep memcached 19563 ? Sl 0:02 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 Then add the appropriate entries to your ``config.php``. This example uses APCu -for the local cache, Memcached as the distributed memcache, and all the +for the local cache, Memcached as the distributed memcache, and lists all the servers in the shared cache pool with their port numbers:: 'memcache.local' => '\OC\Memcache\Memcached', @@ -150,39 +139,34 @@ Redis is an excellent modern memcache to use for both distributed caching, and with :doc:`Transactional File Locking <../configuration_files/files_locking_transactional>` because it guarantees that cached objects are available for as long as they are needed. -This example shows how to install it on Debian/Ubuntu/Mint:: +On Debian/Ubuntu/Mint install ``redis-server`` and ``php5-redis``. The installer +will automatically launch ``redis-server`` and configure it to launch at +startup. - apt-get install redis-server php5-redis - -This example shows how to install and launch it on Red Hat/CentOS/Fedora:: - - yum install redis php-pecl-redis - systemctl enable redis - systemctl start redis +On Red Hat/CentOS/Fedora install ``redis`` and ``php-pecl-redis``. It will not +start automatically, so you must use your service manager to start +``memcached``, and to launch it at boot as a daemon. -You can verify that the redis daemon is running with ``ps``:: - +You can verify that the Redis daemon is running with ``ps ax``:: + + ps ax | grep redis 22203 ? Ssl 0:00 /usr/bin/redis-server 127.0.0.1:6379 This example ``config.php`` configuration uses APCu for the local server cache, -and sets up three distributed servers:: +and sets up three servers in the shared cache pool:: 'memcache.local' => '\OC\Memcache\APCu', 'memcache.distributed' => '\OC\Memcache\Redis', 'redis' => array( 'host' => 'localhost', // optionally, use a Unix socket - //'host' => '/tmp/redis.sock', + // 'host' => '/tmp/redis.sock', + 'host' => 'server1.example.com', + 'host' => 'server2.example.com', 'port' => 6379, 'timeout' => 0.0, - ), - - 'memcached_servers' => array( - array('localhost', 6379), - array('server.example.com', 6379), - array('server2.example.com', 6379), - ), - + ), + Redis is very configurable; consult `the Redis documentation `_ to learn more. Cache Directory Location diff --git a/admin_manual/configuration_server/images/cache-1.png b/admin_manual/configuration_server/images/cache-1.png new file mode 100644 index 000000000..ea0f49303 Binary files /dev/null and b/admin_manual/configuration_server/images/cache-1.png differ