-
Notifications
You must be signed in to change notification settings - Fork 2k
memory issues #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello! On Thu, Aug 30, 2012 at 1:39 AM, Ilja Razinkov wrote:
Is it keeping growing infinitely or just use a constant amount of more Were you using 1.0.15.10? Could you confirm that?
There's one change that _G is no longer shared among all the requests
What kind of Lua globals are you using? Are you using _G in the code
Yes, you can get that from the standard Lua API, for example:
And then accessing this /gc interface will give you something like this:
Thank you for your nice words :) If it's not the issue with the _G Best regards, |
Thanks, i`ll added collectgarbage("count") to controlled parameters and will look for correlation. This will narrow problem at least!!
p.s. is there something to look deeper (nginx patch/whatever)? |
Hello! On Fri, Aug 31, 2012 at 2:40 AM, Ilja Razinkov [email protected] wrote:
Please tell me the result when you have it ;)
There's actually a lot of changes in ngx_lua in ngx_openresty 1.2.1.14
Could you please give concrete numbers (for the memory usage) here?
That sounds fine :)
What kind of operating system are you in? Linux? FreeBSD? Solaris? Or Best regards, |
new data:
2012/09/02 13:26:09 2012/09/02 15:31:09 Still there were no code changes before and after upgrade, this is why main suspect is upgrade itself :( |
Hello! On Mon, Sep 3, 2012 at 2:16 AM, Ilja Razinkov [email protected] wrote:
This information is quite important :)
Yes, please use the tools provided by my Nginx SystemTap Toolkit:
I suggest you run these scripts in your test environment first because I'm looking forward to your new results and new findings! Thanks! |
systemtap is not compiled for my linux distrib by default (2.6.26-2-xen-amd64) and seems i need to recompile kernel with some flags enabled for it to work, which is overkill... i try to switch to 1.0.15.10 to doublecheck what happen. may be there is some nginx modules to grab internal info? for now i found HttpStubStatusModule but its minimalistic, just common stats are gathered... thanks for help! |
Hello! On Tue, Sep 4, 2012 at 3:37 AM, Ilja Razinkov [email protected] wrote:
Is it possible for you to upgrade your Linux kernel to 3.5.x? The Alternatively we'll have to wait for the upcoming SystemTap 2.0
That's cool.
I think we really really need dynamic tracing here. If you have a Best regards, |
Hello! Seems like memory hoggins can be produced by lua code still, i see memory spikes even on 1.0.15.10 (though they are much less noticable). Seems like this is happens after requests that do a lot of sequential requests to ngx.location.capture, specifically to Redis and Mysql (via drizzle modlue). Possibly when this requests are timed out en masse. can it be the case? may be they are stacked somewhere inside request with delayed cleanup and this effect spans for a long time period? |
PS: i`ll try to upgrade to 3.5.x in future (and use systemtap), btw, if other attempts will fail... |
i made some test and i can see now that use of location.capture is eating up memory till the end of request and rarely mem usage didnot drops down even after request is finished. test looks like this (just to get the idea): both in old and the last version of openresty. i understand the reasons for this behaviour but for me this is dangerous thing - several heavy requests executed at the same time can "eat up" all the memory... adding collectgarbage("step") does not help much :( is there the way to clean up location.capture internal stuff during request execution manually? seems like this would be a solution to all troubles :) |
Hello! On Fri, Sep 7, 2012 at 2:57 AM, Ilja Razinkov [email protected] wrote:
Could you please confirm that the memory usage keeps rising without Also, could you confirm that memory leaks happen when specific events
The Nginx subrequests all share the same memory pool as the main So it is recommended to use the lua-resty-redis and lua-resty-mysql
Both of these libraries are based on the ngx_lua cosocket API and do Also, they're included and enabled by default in your version of
No, not really. This is one of the limitations in the Nginx subrequest Best regards, |
BTW, are you using LuaJIT 2.0 or the standard Lua 5.1 interpreter? Usually the LuaJIT uses much less memory than the standard Lua interpreter. Best regards, |
Thanks a lot about lua-resty-redis and lua-resty-mysql. i ported our code on this modules instead of Redis2 and Drizzle and... problem is gone! So it was nginx subrequest memory management problem after all. It`s a pitty this behaviour is not described anywhere :( i think it is not "expected by default" and backend servers are doomed to make a lot of calls in sequence, in potentially harmful way. besides that it would be helpful to note this side effect in drizzle/redis2 descriptions... since they are looked as "recommended" modules at openresty.org, where lua-resty-redis/lua-resty-mysql are just noted in change logs. |
Hello! On Wed, Sep 12, 2012 at 2:14 AM, Ilja Razinkov [email protected] wrote:
Good to know that! The lua-resty-* libraries indeed use much less But I'm not 100% sure if libdrizzle leaks here at some edge cases :)
The web site is lagging behind a bit because the cosocket thing and Will you help me improve the openresty.org web site? The source
You can fork and create a pull request or I can send you a commit bit
Glad you like it :) Thanks! |
thanks, i`ll try to help with docs, good stuff needs good docs :) |
Consider it resolved. |
Hello!
Hit one problem: after upgrading Openresty to 1.2.1.14 (from 1.0.**) nginx started to "grow" in memory while serving lua-based calls. In change log i found that lua code execution slightly changed with this version so it seems to be related. where i can read how this change affected memory usage in Lua?
i am using global vars (keeping in mind that they are per-worker, its ok for me), but simply counting thier size i can see that this is not a reason... seems like big chunks of objects are stalled in lua somehow.
BTW, it would be nice to have method to get memory size used by lua in nginx. just to be sure and control this parameter
Any advice is welcome. And thanks for great tool :)
The text was updated successfully, but these errors were encountered: