nginx 100% cpu usage

128 views
Skip to first unread message

lalyos

unread,
Jul 11, 2012, 7:21:49 AM7/11/12
to vcap-dev
a spring mvc app is deployed since 1 week and it started to slow down,
when i connect directly to tomcat its nice fast, but through nginx its
really slow
sometimes it takes 10 or more seconds to serve even a single client
single page request.

top shows that nginx is using 100% cpu
strace is telling that 'munmap' is responsible for 94%. so looks like
some sort of memory problem,but top shows that 400mb is free from the
4gb total memory.

more detailed logs (strace sample/top/nginx acces/error logs)
https://gist.github.com/3089367

note this is a vmware virtual machine.

any help/tip is welcome!

Pieter Noordhuis

unread,
Jul 11, 2012, 11:36:35 AM7/11/12
to vcap...@cloudfoundry.org
I can't tell anything from the logs, partly because they are quite
sparse. There's an entry every few seconds, which doesn't give any
clue about pegging the CPU. The top output shows that nginx is using
more than 400MB of RSS, which is more than I would expect. Does
restarting nginx solve the issue for you?

Cheers,
Pieter

Chunjie Zhu

unread,
Jul 11, 2012, 11:20:42 PM7/11/12
to vcap...@cloudfoundry.org
Suppose you execute strace like "strace -c -p <pid>". The output only takes the syscall time consuming into account, it does not contain the user-land binary code time cost.

So, I suggest you to rely on some fine-grained profiling tool, such as Oprofile on linux.

Regards,
Chunjie


From: "lalyos" <gipsz...@gmail.com>
To: "vcap-dev" <vcap...@cloudfoundry.org>
Sent: Wednesday, July 11, 2012 7:21:49 PM
Subject: [vcap-dev] nginx 100% cpu usage

dda...@gmail.com

unread,
Jul 29, 2012, 3:02:31 AM7/29/12
to vcap...@cloudfoundry.org, gipsz...@gmail.com
Same issue here but with 8Gig RAM in VM. No idea why, restarting nginx like once a day seems to be a workaround.

Zhenkai Jiang

unread,
Sep 6, 2012, 10:12:01 AM9/6/12
to vcap...@cloudfoundry.org, gipsz...@gmail.com, dda...@gmail.com
Reply all
Reply to author
Forward
0 new messages