Environmental System Tuning

Posted by qadeer_ahmad on Tue, 26 May 2020 18:08:50 +0200

The following adjustments are made in the test environment, then the documentation is written.
System tuning:

1. Kernel Parameter Adjustment

additional

net.ipv4.ip_local_port_range = 1024 65535

net.core.somaxconn = 2048

net.core.rmem_default = 262144

net.core.wmem_default = 262144

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

net.ipv4.tcp_rmem = 4096 4096 16777216

net.ipv4.tcp_wmem = 4096 4096 16777216

net.ipv4.tcp_mem = 786432 2097152 3145728

net.ipv4.tcp_max_syn_backlog = 16384

net.core.netdev_max_backlog = 20000

net.ipv4.tcp_fin_timeout = 15

net.ipv4.tcp_max_syn_backlog = 16384

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_max_orphans = 131072

vm.overcommit_memory=1

fs.file-max = 209708

These are added to/etc/Sysctl.confin

2. Handle Number Adjustment

* soft nofile 209870

* hard nofile 209870

This content is added to/etc/security/limits.conf

3. Nproc adjustment

/etc/security/limits.d/90-Nproc.confThe nproc in this file will also be changed to 209870.00 to 200,000.Not the default 1024.

TOMCAT:

4.JDK and TOMCAT version adjustments

You cannot use the openJDK that comes with your system. You should uninstall the openJDK and download the java-jdk. A minimum of 1.7.52 or more is required.Tomcat won't use tomcat6 either.Use tomcat7 or tomcat8.

5.TOMCAT tuning

After tomcat installation, change the maximum number of threads to 5000-8000. URLEncoding to UTF-8, and use NIO instead of BIO, jsvc daemon, which can automatically restart if tomcat hangs.

MYSQL aspects:

6.MYSQL tuning

The mysql configuration changes are as follows

[mysqld]

character-set-server=utf8

max_connections=2000

max_connect_errors = 1000000

long_query_time=2

slow_query_log=on

slow_query_log_file=/home/db/mysqldata/slow.log

log_queries-not-using-indexes = 1

expire_logs_days = 15

skip-name-resolve = 1

skip_external_locking = 1

innodb_io_capacity = 500

innodb_flush_method = O_DIRECT

innodb_lock_wait_timeout = 5

innodb_log_buffer_size = 8388608

innodb_print_all_deadlocks = on

innodb_flush_log_at_trx_commit = 2

innodb_autoextend_increment = 64

innodb_thread_concurrency = 0

innodb_old_blocks_time = 1000

innodb_buffer_pool_instances = 8

innodb_lru_scan_depth = 512

innodb_flush_neighbors = 1

innodb_checksum_algorithm = crc32

innodb_buffer_pool_dump_at_shutdown = on

innodb_buffer_pool_load_at_startup = on

innodb_buffer_pool_dump_pct = 40

innodb_read_io_threads = 8

innodb_write_io_threads = 8

innodb_purge_threads = 4

innodb_page_cleaners = 4

innodb_buffer_pool_size = 120000M

innodb_file_per_table=1

lower_case_table_names=1

[Note]

The main performance impact comparisons here are:

innodb_buffer_pool_size

innodb_log_buffer_size

innodb_log_file_size

skip-name-resolve

table_open_cache

NGINX aspects

8.NGINX Adjustment

The documentation for installing nginx is a bit behind schedule.It needs to be updated.Refer to this article:

https://yq.aliyun.com/articles/7171 .Include the http2.0 module.HTTP 2.0 is faster on https than http

9.nginx Install Third Party Modules

nginx does not have any third-party modules installed, or even openssl modules included, which means you can't use https. At least install openssl first. Others check to see which ones are required online.

The reference parameters are as follows:

./configure --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --with-pcre --with-luajit --add-module=../ngx_cache_purge-2.3/ --add-module=../nginx_upstream_check_module-0.3.0/ -j2 --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-file-aio --with-http_v2_module

Topics: Nginx Tomcat MySQL JDK