Nginx worker process hangs and a CPU load reaches 100%

Source: Internet
Author: User

Nginx of the worker process hangs and a CPU load up to 100%

Scenario Description:

#tcp Connection Status

[Email protected] ~]# Netstat-nat |awk ' {print $6} ' |grep-v ' Foreign ' |grep-v ' established ' |sort|uniq-c|sort-rn

3010 time_wait

537 established

Syn_recv

Fin_wait2

Close_wait

Fin_wait1

9 LISTEN

3 Last_ack

#nginx Process

#cpu Use, R status--run , using CPU the time, obviously a other nginx worker not quite the same .

[[Email protected] ~]# PS axu|grep nginx

root       15878  0.0  0.0    27352  1444?         ss     jul30   0:00 nginx:master   process/use/local/nginx/ Sbin/nginx-c  /use/local/nginx/conf/nginx.conf

nobody     15879  0.9  0.3    36432 11756?       & nbsp s    jul30     7:42   Nginx:worker process                                                                               

nobody   15881 73.2     0.3  36060 11448?        r     Jul30   626:41 nginx:   worker process                                                                               

nobody   15883 72.9     0.3  36116 11428?        r     Jul30   624:24 Nginx:   worker process                                                                              

Nobody 15884 0.8 0.3 36372 11776? S Jul30 7:34 Nginx:worker Process

# memory usage, no problem .

[Email protected] ~]# free-m

Total used free shared buffers Cached

mem:3018 2605 412 0 508 1251

-/+ buffers/cache:845 2172

swap:2047 0 2047

#nginx error log, no output

[Email protected] ~]# tail-f/use/local/nginx/logs/error.log

#top details of CPU Information

Top-14:19:35 up 308 days, 21:47, 1 user, load average: 2.22, 2.59, 2.62

Tasks:86 Total, 3 running, sleeping, 1 stopped, 0 zombie

Cpu0:2.1%us, 2.1%sy, 0.0%ni, 89.0%id, 0.0%wa, 0.0%hi, 6.7%si, 0.0%st

Cpu1:100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Cpu2:100.0%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Cpu3:0.0%us, 0.4%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.4%si, 0.0%st

mem:3090600k Total, 2701600k used, 389000k free, 521064k buffers

swap:2096472k Total, 0k used, 2096472k free, 1294384k cached

    PID user      pr  ni    virt  res  SHR S%cpu%mem  ;   time+    command                                                                                                                    

15883 nobody    25     0 36116  11m 1520 r 99.8     0.4 635:52.34 Nginx:worker process                                                                                                     

15881 nobody    25     0 36060  11m 1520 r 99.5     0.4 638:09.22   Nginx:worker process                                                                                                     

13116 Nobody 0 36616 11m 1512 S 3.7 0.4 0:07.63 Nginx:worker process

official bug Description:

This looks very similar to the problem, fixed in 1.1.1/1.0.7:

*) Bugfix:nginx hogged CPU If all servers in an upstream were marked as

"Down".

> There is only one server in Upstream,which marked ' backup '. After some

> Test,i found this is the reason.

Yes, thank. This is somewhat known issue, ' Backup '

Handling needs attention.

Maxim Dounin

this looks very similar to this problem and is fixed in 1.1.1/1.0.7 :

*) FIX: nginx If in upstream marked " down

> " upstream Span style= "FONT-SIZE:14PX; Font-family: Song body; Background:yellow None repeat scroll 0% 0%; " There is only one server and is marked as " backup

Yes, thank you for your report. This is a known issue andthe "backup" process needs to be noted .


Workaround:

Just find a time to reboot.

Restart Nginx

Reference:

Http://bbs.linuxtone.org/thread-17226-1-1.html


Nginx worker process hangs and a CPU load reaches 100%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.