Re: [E] Fwd: Lua plugin development - Global Variables

2022-07-14 Thread Vishal Garg
Hey, Oh I didn't realize that this was initialized once per VM. I reduced the number of states to 1 and immediately saw it maintaining state. *tslua.so --states=1 /etc/trafficserver/script/global_ratelimiter.lua* Earlier it was set at 64, and thus did not see it happening immediately. This is ama

Re: [E] Fwd: Lua plugin development - Global Variables

2022-07-14 Thread Shu Kit Chan
The global variable in the lua script is available for the lifetime of the ATS. If you use __init__() function to initialize it, you are only doing it once per VM, not once per request. e.g. https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html#example-scripts In "sethos

Re: [E] Fwd: Lua plugin development - Global Variables

2022-07-14 Thread Vishal Garg
Hi @wkaras & @chanshukit, Thanks for your responses. @chanshukit what you've recommended solves one issue of keeping a variable alive for the entire lifetime of a single request. But this variable is not available for the lifetime of ATS itself. That means each new request would initialize it fres