作者:Eddy 历史版本:1 最后编辑:Eddy 更新时间:2024-06-19 18:08
编写版本:v3.3.7
适用版本:所有版本
中间件优化
调整JVM参数,增大内存、调整新生代内存比例等;如:
-XX:SurvivorRatio=8 -Xmx4g -Xms4g -Xmn1536m -Xss300k
;JVM参数说明前端启用多域名访问,多域名方案;3.3.3+新增功能
Web容器参数调优
- Undertow
- UNDERTOW_IO_THREADS=20 #与服务器CPU线程数一致
- UNDERTOW_WORKER_THREADS=256 #可以根据机器情况增大
- UNDERTOW_BUFFER_SIZE=1024
- UNDERTOW_DIRECT_BUFFERS=true
- Undertow
MySQL5.7参数优化
[client] default-character-set = utf8 [mysqld] port = 3306 default-storage-engine = INNODB character-set-server = utf8 collation-server = utf8_general_ci max_connections = 1024 max_allowed_packet = 1024M #影响大SQL执行,仅供参考 lower_case_table_names = 1 innodb_buffer_pool_size = 50G #影响性能,仅供参考 join_buffer_size = 256M #影响性能,仅供参考 read_rnd_buffer_size = 16M #影响性能,仅供参考 sort_buffer_size = 16M #影响性能,仅供参考 innodb_read_io_threads = 10 #影响性能,仅供参考 innodb_write_io_threads = 10 #影响性能,仅供参考 query_cache_type = 1 #影响性能,仅供参考 query_cache_size = 10G #影响性能,仅供参考 #sata/sas硬盘这个值在200 #sas raid10: 2000 #ssd硬盘:8000 #fusion-io(闪存卡):25,000-50,000 innodb_io_capacity=2000 innodb_io_capacity_max=4000 sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
MySQL8.0参数优化
[client] default-character-set = utf8 [mysqld] port = 3306 default-storage-engine = INNODB character-set-server = utf8 collation-server = utf8_bin max_connections = 1024 max_allowed_packet = 64M lower_case_table_names = 1 innodb_buffer_pool_size = 30G innodb_buffer_pool_instances = 10 join_buffer_size = 256M read_rnd_buffer_size = 16M read_buffer_size = 16M sort_buffer_size = 16M open_files_limit = 65535 innodb_read_io_threads = 20 innodb_write_io_threads = 16 innodb_thread_concurrency = 0 innodb_flush_log_at_trx_commit = 2 binlog_format = mixed tmp_table_size = 256M max_heap_table_size = 256M thread_cache_size = 64 disable-log-bin log_slave_updates = 0 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 pid-file=/var/run/mysqld/mysqld.pid
开启nginx的gzip压缩功能,生产部署Nginx3.5.2+新增功能<适用所有版本>
http { # 开启GZIP gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 9; gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json; gzip_disable "MSIE [1-6]\."; gzip_vary on; }