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
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
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
You can simply use a a global variable in the lua script to store the
configuration information
And you can initialize that in the __init__ function, which is run at
the start of the server.
You can see some examples.
here -
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua
There is a way to do this in the C API (global arguments with
TSUserArgSet/Get). But it doesn't look like these functions are supported
in the Lua API. Can you keep the data in a file, perhaps on a RAM disk to
make access fast?
On Wed, Jul 13, 2022 at 4:41 AM Vishal Garg
wrote:
> Hey,
> ATS Ve
Hey,
ATS Version: v9.1
OS: Ubuntu 22.04
I am writing a Lua plugin to allow custom rate limiting logic.
Right now each request has its own Lua state and thus no variables are
shared.
I want to have a piece of config loaded which is read only and shared
across all requests coming in.
Current implem