Views: 1346 (Data available since 06.02.2017)

If memcached is supposed to be used in the project, it is necessary to set it up in accordance with the expected load.

To this effect:

  • Set the following parameters in the file /etc/sysconfig/memcached:
    • MAXCONN = "10240" - the number of simultaneous connections (by default 1024);
    • CACHESIZE="1024" - memory allocated for cache (by default 64 MB);
    • OPTIONS="t 8" - number of memcached flows (by default 4).
  • Note: the parameters MAXCONN, CACHESIZE, and OPTIONS are selected experimentally depending on the nature of load and available resources.

    The size of your file cache may be used to evaluate the memory size necessary for caching (CACHESIZE parameter). If file cache in your project consumes 3 GB, the use of memcache with 256 MB of memory will not be efficient due to frequent preemption

  • Once memcache is set, it must be restarted using the command:
    service memcached restart
  • Next, connect it to bitrix/php_intarface/dbconn.php:

    define("BX_CACHE_TYPE", "memcache");
    define("BX_CACHE_SID", $_SERVER["DOCUMENT_ROOT"]."#01");
    define("BX_MEMCACHE_HOST", "");
    define("BX_MEMCACHE_PORT", "11211");

In case one server is used, work with memcache may be set up through a socket to improve performance:

  • USER="bitrix" - the user on behalf of which memcache will be started up;
  • OPTIONS="-t 8 -s /tmp/memcached.sock" - the number of flows and a path to the socket..

After that, the settings must be changed in bitrix/php_interface/dbconn.php:

define("BX_CACHE_TYPE", "memcache");
define("BX_CACHE_SID", $_SERVER["DOCUMENT_ROOT"]."#01");
define("BX_MEMCACHE_HOST", "unix:///tmp/memcached.sock");
define("BX_MEMCACHE_PORT", "0");

Courses developed by «Bitrix», Inc.