hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教 --
我猜是 shdict 满了。 注意如果 shdict 数据满了会通过 LRU 淘汰掉部分数据。所以在设定大小的时候需要预估好。在 2017年9月11日 下午3:49, <rets...@gmail.com>写道:hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教 --
测试了一下,把shared.dict提高了10倍,不是这个原因。测试中继续发现,实际上set到shaed.dict是成功的,(我用add方法测试是否已经写成功),是get的时候,不能完全遍历到所有内容在 2017年9月11日星期一 UTC+8下午4:16:28,Zexuan Luo写道:我猜是 shdict 满了。 注意如果 shdict 数据满了会通过 LRU 淘汰掉部分数据。所以在设定大小的时候需要预估好。在 2017年9月11日 下午3:49, <rets...@gmail.com>写道:hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教 --
你 get 的时候,key 没有过期吧?On Monday, September 11, 2017 at 4:33:18 PM UTC+8, rets...@gmail.com wrote:测试了一下,把shared.dict提高了10倍,不是这个原因。测试中继续发现,实际上set到shaed.dict是成功的,(我用add方法测试是否已经写成功),是get的时候,不能完全遍历到所有内容在 2017年9月11日星期一 UTC+8下午4:16:28,Zexuan Luo写道:我猜是 shdict 满了。 注意如果 shdict 数据满了会通过 LRU 淘汰掉部分数据。所以在设定大小的时候需要预估好。在 2017年9月11日 下午3:49, <rets...@gmail.com>写道:hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教 --
hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教
lua_shared_dict
另外你可以试一下,safe_set,或者safe_add在 2017年9月11日星期一 UTC+8下午3:49:22,rets...@gmail.com写道:hi:在nginx.conf中配置API方式:location ~ ^/api/([-_a-zA-Z0-9/]+){ content_by_lua_file lua/api/$1.lua; }api通过一个lua函数向shared_dict更新数据:local function method_get( args ) local succ,err,force = iplist:set(ip,code,exp)end现在发生的的问题:1.nginx低负载情况下,没有问题2.nginx高负载情况下,虽然succ返回true,但是再次获取iplist内内容时,发现已set的数据,较高概率会丢失。求指教