openresty 内存增长的疑惑

123 views
Skip to first unread message

valjean hao

unread,
May 30, 2020, 12:31:36 PM5/30/20
to openresty
最近刚刚接触openresty,打算用openresty做一些模拟接口,替换线上的一些废弃但是必须有返回值的接口。 
刚开始时,用的方式一类似的配置的。 


接口替换成openresty后,发现 openresty的内存,一直在缓慢的增加。( systemclt status openresty 查看的)。 


随后在本地,改用方式二配置测试。

机器: Linux 5.6.12-1-MANJARO x86_64  
nginx version: openresty/1.15.8.3

利用  wrk -t10 -c10 -d20s  curl http://localhost:5000/mock/test  进行压测,发现openresty 的内存也是一直在增加,而且
压测停止后,这部分的内存并没有释放。

在网上查了好久,还是没搞明白为什么会出现这样的一个情况,还请帮忙看一下,谢谢。。

 

valjean hao

unread,
May 30, 2020, 12:40:48 PM5/30/20
to openresty
在首次压测情况时, 内存会有几M一直增加几百M, 
将压测时间调长后, 内存会一直持续增加

在 2020年5月31日星期日 UTC+8上午12:31:36,valjean hao写道:

liu degui

unread,
Jun 3, 2020, 3:50:41 AM6/3/20
to openresty
我猜你用了共享内存,然后共享内存使用完后没有删除


在 2020年5月31日星期日 UTC+8上午12:31:36,valjean hao写道:
最近刚刚接触openresty,打算用openresty做一些模拟接口,替换线上的一些废弃但是必须有返回值的接口。 

valjean hao

unread,
Jun 6, 2020, 4:31:58 AM6/6/20
to openresty


你好, 没有使用共享内存。就是简单的返回json字符串。 类似配置如下,没有其他的复杂逻辑

server {
listen 5000;
charset utf-8;

location = /mock/restapi {
default_type text/html;
content_by_lua_block { ngx.say("{\"code\":\"200\",\"message\":\"success\"}")}
}

}

利用wrk 压测的时候,内存就会持续增长。

在 2020年6月3日星期三 UTC+8下午3:50:41,liu degui写道:

DeJiang Zhu

unread,
Jun 21, 2020, 9:38:38 AM6/21/20
to open...@googlegroups.com
如果是你上面贴的那种简单接口,不应该持续增长的,估计是其他没有注意的地方

这种用 xray 来分析是最合适的了

valjean hao <valje...@gmail.com> 于2020年6月6日周六 下午4:32写道:
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
---
您收到此邮件是因为您订阅了Google网上论坛上的“openresty”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到openresty+...@googlegroups.com
要在网络上查看此讨论,请访问https://groups.google.com/d/msgid/openresty/34d5464c-4841-4860-a669-376ad9932c06o%40googlegroups.com
Reply all
Reply to author
Forward
0 new messages