Тонкая настройка Linux

Описанные ниже действия являются опциональными и предназначены для высоконагруженных экземпляров Сервера управления BI.ZONE EDR.
Ожидаемая версия ядра Linux — 3.10

Для тонкой настройки Linux:

  1. Скопируйте содержимое конфигурационного файла в файл /etc/sysctl.d/sensors.conf.

    Примечание: содержимое конфигурационного файла для копирования

    # # Linux 3.10 tuning advisor for Sensors server. # # Note the guide is intended for large-scale deployments, therefore it is # assumed the servers are at least of 16 vCPU and 64GB RAM. The target number # of concurrent connections is 1M with request rate ~32K rps. # # The config should be saved to /etc/sysctl.d/sensors.conf and applied with the # following command: # > sysctl -p /etc/sysctl.d/sensors.conf # # Refer to http://man7.org/linux/man-pages/man5/sysctl.d.5.html for details. # #--------------------------------------------------------------------------- # File Descriptors # # Ref: # - https://www.kernel.org/doc/Documentation/sysctl/fs.txt # # Set the maximum number of open file descriptors enforced at the kernel level. fs.file-max=10000000 # # Max number of of file-handles a process can allocate. fs.nr_open=2000500 # # Additionally, the limit should be updated with ulimit - 2M per-process file # descriptors (or use systemd LimitNOFILE=2000500): # > ulimit -n 2000500 # #--------------------------------------------------------------------------- # Networking # # Maximum number of packets, queued on the INPUT side, when the interface # receives packets faster than kernel can process them. net.core.netdev_max_backlog=32768 # # tcp_max_syn_backlog sets the maximum number of half-open connections for which # the client has not yet sent an ACK response can be kept in the queue. # # Ref: # - http://lxr.linux.no/linux+v3.10/Documentation/networking/ip-sysctl.txt#L281. # net.ipv4.tcp_syncookies=1 net.ipv4.tcp_max_syn_backlog=32768 net.core.somaxconn=32768 # # tcp_tw_reuse allows reusing sockets in TIME_WAIT state for new connections # when it is safe from protocol viewpoint. Default value is 0 (disabled). # The tcp_tw_reuse setting is particularly useful in environments where numerous # short connections are open and left in TIME_WAIT state, such as web servers. # # CAUTION: Don't use tcp_tw_recycle if the service is behind an LB or any NAT - # the server can't distinguish new incoming connections from different clients # behind the same NAT device. # # Ref: # - http://lxr.linux.no/linux+v3.10/Documentation/networking/ip-sysctl.txt#L459. # net.ipv4.tcp_tw_reuse=1 # # Kernel buffers. # # OPTIONAL: For extra-large deployments only. Kernel regulates these buffers on # its own optimally in the vast majority of cases; rarely, it could be useful to # increase net.ipv4.tcp_mem. # # Ref: # - http://lxr.linux.no/linux+v3.10/Documentation/networking/ip-sysctl.txt#L380. # - http://lxr.linux.no/linux+v3.10/Documentation/networking/ip-sysctl.txt#L502. # - http://lxr.linux.no/linux+v3.10/Documentation/networking/ip-sysctl.txt#L296. # #net.core.rmem_max=16384 #net.core.wmem_max=16384 #net.ipv4.tcp_rmem=1024 4096 16384 #net.ipv4.tcp_wmem=1024 4096 16384 #net.ipv4.tcp_mem=1000000 1000000 1000000 # # Outbound connections. # net.ipv4.ip_local_port_range=1024 65535 net.ipv4.tcp_fin_timeout=30 # #--------------------------------------------------------------------------- # Miscellaneous # # Pre-allocate huge pages (16000 pages for 32GB RAM). # # OPTIONAL: For extra-large deployments only. The value is deployment specific # and should be adjusted in accordance to the actual server resources. # # Better use of Translation-Lookaside Buffer (TLB) caches by the processor. # These caches contain virtual-to-physical address translations and have a small # number of entries with the most-recently used pages. Using huge pages of 2 MB # instead of the normal 4 KB pages, a TLB entry can handle much more memory, # thus making the CPU caching more efficient. # #vm.nr_hugepages=16000 #
  2. Выполните команду для применения конфигурации:

    sysctl -p /etc/sysctl.d/sensors.conf
  3. Переопределите значение LimitNOFILE для systemd-юнита службы bzserver:

    systemctl edit bzserver
  4. В открывшемся редакторе введите:

    [Service] LimitNOFILE=2000500
  5. Примените изменения и перезапустите Сервер управления:

    systemctl daemon-reload systemctl restart bzserver
  6. Убедитесь, что изменения вступили в силу:

    systemctl show -p LimitNOFILE bzserver cat /proc/$(pidof server)/limits | grep "Max open files"