TIME_WAIT is higher than ESTABLISHED

General support questions
Post Reply
mahesh2150
Posts: 16
Joined: 2017/10/17 17:15:47

TIME_WAIT is higher than ESTABLISHED

Post by mahesh2150 » 2017/10/23 12:32:57

Code: Select all

netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n

Code: Select all

      1 established)
      1 Foreign
     14 FIN_WAIT1
     14 LISTEN
     15 SYN_RECV
   2377 ESTABLISHED
   7734 TIME_WAIT
Are more visitors waiting to connect on the server?

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: TIME_WAIT is higher than ESTABLISHED

Post by avij » 2017/10/23 13:33:49

Perhaps you should read up on what TIME_WAIT means.. Connections move to TIME_WAIT state when the connection is being closed, ie. after ESTABLISHED.

Perhaps you should enable HTTP keepalive support in your web server, and perhaps increase the maximum number of requests that can be served over one connection, and perhaps also increase the time the connection is kept alive.

mahesh2150
Posts: 16
Joined: 2017/10/17 17:15:47

Re: TIME_WAIT is higher than ESTABLISHED

Post by mahesh2150 » 2017/10/23 13:43:22

Sir

I am new to this.

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 52 total children

I am getting this error.

Code: Select all

top -c

%Cpu(s): 70.6 us,  8.2 sy,  0.0 ni, 20.8 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st

Code: Select all

max_children = 700
pm.start_servers = 30
pm.min_spare_servers = 20
pm.max_spare_servers = 40
pm.max_requests = 2000

Code: Select all

nginx
worker_processes auto
worker_connections 15000;
worker_rlimit_nofile 70000;
There is free ram
KiB Mem : 32740464 total, 15831456 free, 1106152 used, 15802856 buff/cache
But i am still hitting the cpu and getting those error messages in error log

mahesh2150
Posts: 16
Joined: 2017/10/17 17:15:47

Re: TIME_WAIT is higher than ESTABLISHED

Post by mahesh2150 » 2017/10/23 13:47:03

Code: Select all

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 52 total children
But it is no use in increasing the pm.start_servers and pm.min/max_spare_servers.
I am getting the problem immediately

If i have 20 start_servers, and max_connection is 2000 can it handle 40,000 connections?
What is max_children?

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: TIME_WAIT is higher than ESTABLISHED

Post by avij » 2017/10/23 14:05:01

Is there some reason why you are not asking these questions on the Nginx support forum? CentOS still does not ship Nginx.

You need to get the "bigger pieces" in place first, that is Nginx and whatever else you are running on your server. Fix their performance problems first, if you think they are not performing as well as you hope. The various sysctl tunables are for fine tuning only.

Post Reply