set $redis_host '192.168.2.123';
set $redis_port '6379';
set $redis_connect_timeout 200;
set $redis_dbid 0;
set $redis_pool_size 1000;
set $redis_keepalive_timeout 500;
set $shdict_expire 180; #set expire timer to get rules from redis
set $rt_cache_lock rt_locks; #set name of cache locks, should be same as lua_shared_dict
set $up_cache_lock up_locks;
set $lock_expire 0.001 ; #wait for cache_lock 0.001 seconds
set $hostkey $server_name;
set $sysConfig api_root_sysConfig;
set $kv_upstream kv_api_root_upstream;
set $backend 'upserver'; #default upstream
在同一台Linux机器上,使用压测工具siege,并发为100 1、关闭 rewrite_by_lua_file '/data/code/ABTestingGateway/diversion/diversion.lua'; 使用top查看,cpu消耗低于10% 2、打开 rewrite_by_lua_file '/data/code/ABTestingGateway/diversion/diversion.lua'; 使用top查看,cpu消耗达到30%以上 配置如下,有一个疑问引入cache是需要设置那个参数? 我经过测试,不是每次都去请求redis,应该是使用了cache; 但为什么同样的nginx配置,并且引用了cache,打开和注释掉diversion.lua,消耗的cpu会如此大? 3、并发设置为1000之后,打开diversion.lua,cpu的消耗并不是线性增加,大概50%多 问题: 请问你在压测阶段,对于CPU消耗百分百会有这个情况吗? 这属于正常情况吗?或者有什么优化的配置需要设置? 目前只使用了iprange分流,设置了4个ip段;以下是nginx的配置,还请指导是不是配置参数的原因?
nginx配置: lua_code_cache on; lua_package_path "/data/code/ABTestingGateway/?.lua;/data/code/ABTestingGateway/lib/?.lua;/data/code/ABTestingGateway/lib/lua-resty-core/lib/?.lua;;"; lua_need_request_body on; lua_shared_dict api_root_sysConfig 1m; lua_shared_dict kv_api_root_upstream 100m; lua_shared_dict api_abc_sysConfig 1m; lua_shared_dict kv_api_abc_upstream 100m; lua_shared_dict rt_locks 100k; lua_shared_dict up_locks 100k;
set $redis_host '192.168.2.123'; set $redis_port '6379'; set $redis_connect_timeout 200; set $redis_dbid 0; set $redis_pool_size 1000; set $redis_keepalive_timeout 500; set $shdict_expire 180; #set expire timer to get rules from redis set $rt_cache_lock rt_locks; #set name of cache locks, should be same as lua_shared_dict set $up_cache_lock up_locks; set $lock_expire 0.001 ; #wait for cache_lock 0.001 seconds set $hostkey $server_name; set $sysConfig api_root_sysConfig; set $kv_upstream kv_api_root_upstream; set $backend 'upserver'; #default upstream
redis中的有的设置: ab:runtimeInfo:www.xxx.com:first:userInfoModulename ab:runtimeInfo:www.xxx.com:first:divModulename ab:runtimeInfo:www.xxx.com:first:divDataKey