Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions doc/admin-guide/plugins/lua.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,60 @@ If it is used as remap plugin, we can write the following in remap.config to def

map http://a.tbcdn.cn/ http://inner.tbcdn.cn/ @plugin=/XXX/tslua.so @pparam=--states=64 @pparam=/XXX/test_hdr.lua

The maximum number of allowed states is set to 256 which is also the
default states value. The default value can be globally changed by
adding a configuration option to records.config.

::

CONFIG proxy.config.plugin.lua.max_states INT 64

Any per plugin --states value overrides this default value but must be less than or equal to this value. This setting is not reloadable since it must be applied when all the lua states are first initialized.

Profiling
=========

The lua module collects runtime statistics about the lua states, for remap
and global instances. Per state stats are constantly maintained and are
made available through a lifecycle hook. These may be accessed through:

::

traffic_ctl plugin msg ts_lua stats_print

Sample output:

::

[Feb 5 19:00:15.072] ts_lua (remap) id: 0 gc_kb: 2508 gc_kb_max: 3491 threads: 417 threads_max: 438
[Feb 5 19:00:15.072] ts_lua (remap) id: 1 gc_kb: 1896 gc_kb_max: 3646 threads: 417 threads_max: 446
[Feb 5 19:00:15.072] ts_lua (remap) id: 2 gc_kb: 3376 gc_kb_max: 3740 threads: 417 threads_max: 442

Max values may be reset at any time by running:

::

traffic_ctl plugin msg ts_lua stats_reset


Summary statistics are aggregated every 5s and are available as metrics.

::

traffic_ctl metric match lua

Sample output:

::

plugin.lua.global.states 8
plugin.lua.remap.gc_bytes_min 4804608
plugin.lua.remap.gc_bytes_mean 5552537
plugin.lua.remap.gc_bytes_max 5779456
plugin.lua.remap.threads_min 31
plugin.lua.remap.threads_mean 44
plugin.lua.remap.threads_max 146

TS API for Lua
==============

Expand Down
Loading