Caching config manual
Using RAM caching
The kernel version 8.5.1 supports both disk and shared memory caching.
PHP accelerator supports API handling of shared memory. It means that all web server processes can read and write into single address space. This allows to organize shared synchorouns cache.
Although the app data caching performed into a file at the file system level, sometimes (e. g. backup copying) there are cases when this cache is removed and becomes useless for further use.
The advantage of shared accelerator cache is its location within RAM. Using of swap indicates the inadequate hosting setup. The disadvantage of the swap file - its full reset when server is re-started.
|The software app||Description||Version|
|APC||Uses the available shared memory features. Provides the following PHP features for programming: apc_fetch, apc_store and apc_delete.
|eAccelerator||When creating a distributive, specify "--with-eaccelerator-shared-memory". It has the same disadvantages as the APC. Advantage: cache saving onto the disk can be configured.
Note. eAccelerator is incompatible with PHP version higher than 5.3
|Is not supported from version 15.5.0|
Aside from accelerators, a similar feature-rich memcached daemon is available.
It is a separate process that uses TCP/IP protocol for communications. It can support distributed, shared, synchronous cache. More than one server can be connected to the server with launched memcached. Using memcached solves accelerator cache problems, but the reduced performance due protocol transfer is a priority as well.
Example of operation with memcached on Ubuntu. Installation:
aptitude install memcached
Daemon settings are properly documented and located in the file /etc/memcached.conf
There are three extensions for PHP to work with memcached server. When using memcache, unixsocket can be connected to it via:
define("BX_MEMCACHE_HOST", "unix:///path/to/memcached.sock"); define("BX_MEMCACHE_PORT", "0");
However, pre-configured memcached is required to work via sockets. To do it, go to memcached settings file and modify OPTIONS="" string to OPTIONS="-s /tmp/memcached.sock -a 00755". Only after that, modifications can be made to dbconn.php.
Cache management is perfumed via constants, defined in the file dbconn.php (In kernel version higher than 14.0 settings are performed in other files).
|BX_CACHE_TYPE||The most important constant. In can the following values:
|BX_CACHE_SID||Check if more than one Bitrix Site Manager instances are launched. This salt is added to all cache keys. It allows avoiding "confusion" between them.
|BX_MEMCACHE_HOST||Required only if memcache is used. It determines the server URL with launched memcached daemon.
|BX_MEMCACHE_PORT||Optional, has the value 11211 by default.|