Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have enough memory and cpu but nginx shows 503 error in high traffic.

Here is memory usages

             total       used       free     shared    buffers     cached
Mem:          3383       3370         12          0         37       3071
-/+ buffers/cache:        260       3122
Swap:         4094          0       4094

Also cpu usages never exceeds 20%

top - 13:31:10 up 43 days,  6:47,  3 users,  load average: 0.16, 0.19, 0.22
Tasks:  95 total,   1 running,  92 sleeping,   2 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 96.7%id,  3.2%wa,  0.0%hi,  0.0%si,  0.2%st
Mem:   3464192k total,  3450844k used,    13348k free,    53248k buffers
Swap:  4192944k total,      100k used,  4192844k free,  3135820k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0 10364  648  552 S  0.0  0.0   0:04.33 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:14.15 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      10  -5     0    0    0 S  0.0  0.0   0:01.10 events/0

I use this code to see active connections: netstat -an |grep :80 |wc -l

Everything is okay when This shows a number under 1500, But when it goes over 1500, users get 503 error.

I have set: worker_processes 2; and worker_connections 2024;

But still getting this error.

Please help me and suggest how to fix this. And let me know What causing this error. I am using nginx 0.8.55

Thank you.

share|improve this question
2  
Is nginx proxying to another HTTP/FCGI server, or just serving static files? –  mgorven Jul 29 '12 at 19:37
    
Yes I am using fast-cgi to serve php files. But this error occurs for both php and static file. –  Suman Biswas Jul 30 '12 at 13:01

1 Answer 1

up vote 0 down vote accepted

Try increasing worker_rlimit_nofile and worker_connection, anyway it is good to see whats happening in the error_log. eg:

worker_rlimit_nofile 65535;
events {
    worker_connections  65535;
}
share|improve this answer
    
Thank you for your reply. Is 65535 a fixed number? Or how it differs according to my system configuration. I will be grateful if you explain this. –  Suman Biswas Aug 6 '12 at 11:11
    
It has upper limit of maximum open file descriptors in OS, eg in linux it can be found at /proc/sys/fs/file-max. 65535 has no meaning you can change it. –  Andrei Mikhaltsov Aug 6 '12 at 12:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.