Skip to content

Commit c125fd0

Browse files
committed
code and documentation for lua states configuration and stats printing
1 parent e4c8e6c commit c125fd0

File tree

8 files changed

+628
-36
lines changed

8 files changed

+628
-36
lines changed

doc/admin-guide/plugins/lua.en.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,60 @@ If it is used as remap plugin, we can write the following in remap.config to def
128128

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

131+
The maximum number of allowed states is set to 256 which is also the
132+
default states value. The default value can be globally changed by
133+
adding a configuration option to records.config.
134+
135+
::
136+
137+
CONFIG proxy.config.plugin.lua.max_states INT 64
138+
139+
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 is must be applied when all the lua states are first initialized.
140+
141+
Profiling
142+
=========
143+
144+
The lua module collects runtime statistics about the lua states, for remap
145+
and global instances. Per state stats are constantly maintained and are
146+
made available through a lifecycle hook. These may be accessed through:
147+
148+
::
149+
150+
traffic_ctl plugin msg ts_lua stats_print
151+
152+
Sample output:
153+
154+
::
155+
156+
[Feb 5 19:00:15.072] ts_lua (remap) id: 0 gc_kb: 2508 gc_kb_max: 3491 threads: 417 threads_max: 438
157+
[Feb 5 19:00:15.072] ts_lua (remap) id: 1 gc_kb: 1896 gc_kb_max: 3646 threads: 417 threads_max: 446
158+
[Feb 5 19:00:15.072] ts_lua (remap) id: 2 gc_kb: 3376 gc_kb_max: 3740 threads: 417 threads_max: 442
159+
160+
Max values may be reset at any time by running:
161+
162+
::
163+
164+
traffic_ctl plugin msg ts_lua stats_reset
165+
166+
167+
Summary statistics are aggregated every 5s and are available as metrics.
168+
169+
::
170+
171+
traffic_ctl metric match lua
172+
173+
Sample output:
174+
175+
::
176+
177+
plugin.lua.global.states 8
178+
plugin.lua.remap.gc_bytes_min 4804608
179+
plugin.lua.remap.gc_bytes_mean 5552537
180+
plugin.lua.remap.gc_bytes_max 5779456
181+
plugin.lua.remap.threads_min 31
182+
plugin.lua.remap.threads_mean 44
183+
plugin.lua.remap.threads_max 146
184+
131185
TS API for Lua
132186
==============
133187

0 commit comments

Comments
 (0)