单机模式standalone-config.json配置优化
优化建议:
单机版默认使用MySQL存储统计结果数据,Mysql的读写压力较大,需要预留服务器内存的30%~40%给MySQL服务。 此外redis的主从模式可能会存在单点写入故障问题,所以单机版的redis仍使用集群模式,即启动6个节点。
本服务按照以下规则进行配置:
整体按照:Mysql占用约1/3内存,其他服务占用1/3内存,空闲1/3内存。
redis_max_memory * 6 + standalone_xmx_memory + insights_xmx_memory <= 系统总内存的*30%。
mysql_max_memory ≈ innodb_buffer_pool_size + max_connections * (tmp_table_size + read_buffer_size + sort_buffer_size + ...)
如果服务器资源较为紧张,请务必关注服务器的内存使用率相关数据,内存使用率如果超过70%,请及时进行相关参数调整或扩容,防止内存刷满,导致服务故障(严重时可能会导致服务器无法登录的情况,需要重启解决)!
standalone-config.json快速配置参考
如果您对于各组件优化缺乏相关经验,可以按照自身服务器配置情况,直接拷贝以下配置即可!
单节点8G内存配置参考
- standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "500M", "standalone_xms_memory": "500M", "insights_xmx_memory": "256M", "insights_xms_memory": "256M" }, "redis": { "max_memory": "220M" }, "mysql": { "max_connections": "50", "innodb_buffer_pool_size": "600M", "tmp_table_size": "8M", "max_heap_table_size": "8M" } }
单节点16G内存配置参考
- standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "1000M", "standalone_xms_memory": "1000M", "insights_xmx_memory": "512M", "insights_xms_memory": "512M" }, "redis": { "max_memory": "450M" }, "mysql": { "max_connections": "80", "innodb_buffer_pool_size": "1300M", "tmp_table_size": "10M", "max_heap_table_size": "10M" } }
单节点32G内存配置参考
- standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "2000M", "standalone_xms_memory": "2000M", "insights_xmx_memory": "1024M", "insights_xms_memory": "1024M" }, "redis": { "max_memory": "900M" }, "mysql": { "max_connections": "100", "innodb_buffer_pool_size": "2600M", "tmp_table_size": "16M", "max_heap_table_size": "16M" } }
单节点64G内存配置参考
standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "3000M", "standalone_xms_memory": "3000M", "insights_xmx_memory": "1024M", "insights_xms_memory": "1024M" }, "redis": { "max_memory": "1800M" }, "mysql": { "max_connections": "151", "innodb_buffer_pool_size": "5200M", "tmp_table_size": "16M", "max_heap_table_size": "16M" } }
单节点128G内存配置参考
standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "3000M", "standalone_xms_memory": "3000M", "insights_xmx_memory": "1024M", "insights_xms_memory": "1024M" }, "redis": { "max_memory": "3600M" }, "mysql": { "max_connections": "151", "innodb_buffer_pool_size": "10000M", "tmp_table_size": "32M", "max_heap_table_size": "32M" } }
单节点256G内存配置参考
- standalone-config.json配置
{ "lighthouse": { "timezone": "Asia/Shanghai", "standalone_xmx_memory": "5000M", "standalone_xms_memory": "5000M", "insights_xmx_memory": "2048M", "insights_xms_memory": "2048M" }, "redis": { "max_memory": "7200M" }, "mysql": { "max_connections": "200", "innodb_buffer_pool_size": "20000M", "tmp_table_size": "64M", "max_heap_table_size": "64M" } }