openresty / lua-resty-limit-traffic

Lua library for limiting and controlling traffic in OpenResty/ngx_lua
819 stars 150 forks source link

limit connection 's question #9

Closed cellcb closed 8 years ago

cellcb commented 8 years ago

hi i have a question about " CONN.LUA" ngx.shared.DICT.incr is atomic operation?

How to ensure “conn, err = dict:incr(key, -1)” is right

thank you

doujiang24 commented 8 years ago

Yes, it's atomic operation :)

cellcb commented 8 years ago

I USE JMETER testing pressure
DICT:INCR cant ensure is right

stop testing pressure dict:get(key) not fall

agentzh commented 8 years ago

@cellcb All the shdict methods are atomic, regardless the number of your nginx worker processes or concurrency level. I'm having problems understanding your English. Sorry. I'm closing this.