Improving the performance of CMS Bitrix

To improve the performance of a site on CMS Bitrix, it is recommended to transfer it to a server with a BitrixVM control panel.

You can order a virtual or dedicated server with the BitrixVM panel on our website.

When ordering a virtual or dedicated server with the BitrixVM panel and standard administration our specialists will transfer all your sites for free. You can also transfer sites yourself.

Setting up CMS Bitrix

  1. In the System Check section, all entries must be specified correctly, without errors.
  2. In the Performance Panel section, in the Bitrix tab, set the Bitrix value (optimal).
  3. Set DB table type to InnoDB. It is also recommended to perform database optimization. Make a backup first.

Server Tuning

1. Connect to the server by ssh as root.

2. To start the BitrixVM virtual environment run:

~/menu.sh

3. Click 4 Configure memcahed servers.

4. Next, memcached will be installed. In the process, when prompting for the hostname of the server, specify the ServerName from the table displayed on the screen.

5. Next open the config file /etc/sysconfig/memcached

vi /etc/sysconfig/memcached

By default, BitrixVM uses vi editor.

You can also install the more common nano editor. To do this, run the command:

yum install -y nano

To open the config file /etc/sysconfig/memcached using nano editor enter:

nano /etc/sysconfig/memcached

6. In an open configuration file, set the following parameters:

# number of concurrent connections (default 1024)

MAXCONN = "1024"




# the amount of memory allocated for the cache (default 64MB)

CACHESIZE = "1024"




# number of memcached threads

OPTIONS = "- t 4"

Save your changes to the file.

7. To restart the service run:

systemctl restart memcached.service

8. Open the file /bitrix/php_interface/dbconn.php :

nano /path/to/site/bitrix/php_interface/dbconn.php

/path/to/site/ in Bitrix 7 is usually  /home/bitrix/www/

9. To connect memcached in the file, set the following parameters:

define("BX_CACHE_TYPE", "memcache");

define("BX_CACHE_SID", $_SERVER["DOCUMENT_ROOT"]."#01");

define("BX_MEMCACHE_HOST", "127.0.0.1");

define("BX_MEMCACHE_PORT", "11211");

Save your changes to the file.

10. Open the file /bitrix/.settings_extra.php:

nano /path/to/site/bitrix/.settings_extra.php

Set the following parameters in the open file:

<?php

return array(

  'cache' => array(

    'value' => array(

      'type' => 'memcache',

      'memcache' => array(

        'host' => '127.0.0.1',

        'port' => '11211',

      ),

      'sid' => $_SERVER["DOCUMENT_ROOT"]."#01"

    ),

  ),

);

?>

Save your changes to the file.

To speed up the site, it is also recommended to move the directory for MySQL temporary files to a RAM disk.

1. Create a folder for temporary files:

mkdir /var/lib/mysql/tmp

2. Set the owner and group of the folder:

chown mysql:mysql /var/lib/mysql/tmp

3. To find out the mysql user and group identifiers (uid and gid), enter:

id mysql

4. Open the file /etc/fstab:

nano /etc/fstab

5. At the end of the file add the line:

tmpfs /var/lib/mysql/tmp tmpfs rw,gid=27,uid=27,size=2G,nr_inodes=10k,mode=0700 0 0

When setting size, consider the amount of RAM available.

6. Mount the partition:

mount /var/lib/mysql/tmp

7. Add line in MySQL config file /etc/mysql/my.cnf/:

tmpdir=/var/lib/mysql/tmp

8. To restart MySQL, enter:

systemctl restart mysqld

To use deferred transactions open the file /etc/mysql/conf.d/z_bx_custom.cnf and add to it:

innodb_flush_log_at_trx_commit = 0

If you have any questions, please create a ticket to technical support.