Hey Guys,
Several questions about the ts-lua , just start to use it, so some question may
seem very simple
1. question about log part “[globalHookHandler] has txn hook -> adding txn
close hook handler to release resources”
for example I’m using the following code, and the debug log shows above log ,
do I need to do anything to handle a txt close hook to release the resource, or
I should just ignore the log
function do_some_work()
- - do some logic
return 0
end
function do_global_read_request()
ts.debug('this is do_global_read_request')
ts.hook(TS_LUA_HOOK_READ_REQUEST_HDR, do_some_work)
return 0
end
2. question for ts.schedule
what does “after do_remap” means, is that after hook TS_HTTP_POST_REMAP_HOOK ?
what are the types in “ THREAD_TYPE” other than the one in the example
"TS_LUA_THREAD_POOL_NET”, and what’s the different between those types.
ts.schedule
syntax: ts.schedule(THREAD_TYPE, sec, FUNCTION, param1?, param2?, ...)
context: after do_remap
3. init function being called when traffic_server starts
is there a init function being called when traffic_server starts, like the
following in nginx
https://github.com/openresty/lua-nginx-module#init_worker_by_lua
<https://github.com/openresty/lua-nginx-module#init_worker_by_lua>
4. Global shared lua dict
is there a global shared lua dict, that will not has the lift time as ts.ctx,
something like lua_shared_dict in nginx ?
What I’m trying to do here is that when traffic server starts up, it will try
to call a init script, which will init a scheduler to fetch a url either
internal or external and get that response store to a shared_lua_dict as
key/value pairs, and later on each of the request comes to the ATS will try to
check the key/values use that shared_lua_dict. With that in mind, I need to
understand those 4 questions above.
Thanks,
Di Li