> 想通过 nginx.conf : set $mod_var "true"; 的方式向ngx lua module传递初始化参数
> 但是过多的ngx.var.VARIABLE定义是否会影响最终服务的内存消耗量?
只要这些变量本身不要存储特别大的内容,就没问题。这些变量的有效期是绑定在会话上的,会话结束,变量占用的内存资源也都会被释放。
原文:
When reading from an Nginx variable, Nginx will allocate memory in the per-request memory pool which is freed only at request termination
我的理解,欢迎一起交流。