9 messages in com.mysql.lists.mysqlRe: TIME_WAIT Connections
FromSent OnAttachments
Shane Corgatelli04 Apr 2000 17:10 
Yann Ramin04 Apr 2000 18:04 
fooler04 Apr 2000 20:02 
Eric Peters05 Apr 2000 03:20 
Jason D. Runyan05 Apr 2000 11:09 
Rohit Mathur05 Apr 2000 12:05 
Robert Goff05 Apr 2000 13:05 
Robert Alexander05 Apr 2000 13:57 
Ben Willis05 Apr 2000 14:18 
Subject:Re: TIME_WAIT Connections
From:fooler (foo@skyinet.net)
Date:04/04/2000 08:02:04 PM
List:com.mysql.lists.mysql

hello shane,

in linux, look at /usr/src/linux/include/net/tcp.h and modify this field and then recompile the kernel

#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to successfully * close the socket, about 60 seconds */

fooler.

Yann Ramin wrote:

Simple problem, simple solution. Increase the number of file descriptors in your system by recompiling thy kernel. If they was FreeBSD, I could tell you how (change maxusers to 128 or 256), but I am not a Linux fanatic. TIME_WAITS are specified in the RFCs: a connection should stay 'open' on one end for unexpected roaming data for 120 seconds after the intial close.

Yann

Shane Corgatelli wrote:

Hello,

I am having a problem with mutliple connections from the web server to the data server setting in TIME_WAIT mode for one minute (see the netstat that I ran on the web server). The problem is that our connection table-space on the web server gets maxed out and people start getting denied. We have been able to patch this problem by making our connections more persistant, but I can only make them as persistent as the script running time. Currently we average about 4 hits per second and are expecting this load to increase very soon. I need to find a way to reduce the number of TIME_WAIT connections before our load increases. Any help would be appreciated.

Thanks, Shane Corgatelli

Server Info:

Data Server MySQL Version: 3.22.25 Operating System: Linux 2.2.5 (Red Hat 6.1)

Web Server Operating System: Linux 2.2.5 (Red Hat 6.1) Web Server: Apache 1.3.3 ? Language: Perl 5

netstat -n | grep 3306 run on the web server shows:

tcp 0 0 192.168.101.25:1045 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1044 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1043 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1042 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1041 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1040 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1039 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1038 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1037 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1036 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1035 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1034 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1033 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1032 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1031 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1030 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1029 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1028 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1027 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1026 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:1025 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4999 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4998 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4997 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4996 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4995 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4994 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4992 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4991 192.168.101.101:3306 TIME_WAIT tcp 0 0 192.168.101.25:4990 192.168.101.101:3306 TIME_WAIT

ps -aux | grep mysql run on the web server shows:

Shane 22529 0.0 0.3 1148 392 ttyp2 R 16:45 0:00 grep mysql

ps -aux | grep sql run on the data server shows:

root 442 0.0 0.0 1664 0 ? SW Mar09 0:00 [safe_mysqld] mysql 467 0.0 7.0 17160 8968 ? SN Mar09 3:42 /usr/sbin/mysqld mysql 471 0.0 7.0 17160 8968 ? SN Mar09 4:28 /usr/sbin/mysqld mysql 472 0.0 7.0 17160 8968 ? SN Mar09 18:23 /usr/sbin/mysqld

mysqladmin -p version proc stat extended-status run on the data server shows:

mysqladmin Ver 7.11 Distrib 3.22.25, for pc-linux-gnu on i686 TCX Datakonsult AB, by Monty

Server version 3.22.25 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 26 days 5 hours 51 min 6 sec

Threads: 1 Questions: 19342678 Slow queries: 256 Opens: 93 Flush tables: 1 Open tables: 42

+---------+-------+-----------+----+-----------+------+-------+------+ | Id | User | Host | db | Command | Time | State | Info | +---------+-------+-----------+----+-----------+------+-------+------+ | 1722899 | Shane | localhost | | Processes | 0 | | | +---------+-------+-----------+----+-----------+------+-------+------+

Uptime: 2267466 Threads: 1 Questions: 19342679 Slow queries: 256 Opens: 93 Flush tables: 1 Open tables: 42

+--------------------------+------------+ | Variable_name | Value | +--------------------------+------------+ | Aborted_clients | 1 | | Aborted_connects | 739 | | Created_tmp_tables | 597 | | Delayed_insert_threads | 0 | | Delayed_writes | 0 | | Delayed_errors | 0 | | Flush_commands | 1 | | Handler_delete | 18155 | | Handler_read_first | 0 | | Handler_read_key | 43797192 | | Handler_read_next | 2542309 | | Handler_read_rnd | 1211588483 | | Handler_update | 54429 | | Handler_write | 884537 | | Key_blocks_used | 7822 | | Key_read_requests | 151668909 | | Key_reads | 42660 | | Key_write_requests | 1151416 | | Key_writes | 84263 | | Max_used_connections | 13 | | Not_flushed_key_blocks | 0 | | Not_flushed_delayed_rows | 0 | | Open_tables | 42 | | Open_files | 61 | | Open_streams | 0 | | Opened_tables | 93 | | Questions | 19342679 | | Running_threads | 1 | | Slow_queries | 256 | | Uptime | 2267466 | +--------------------------+------------+

mysqladmin -p variables run on the data server shows:

+----------------------------+---------------------------+ | Variable_name | Value | +----------------------------+---------------------------+ | back_log | 5 | | connect_timeout | 5 | | basedir | / | | datadir | /var/lib/mysql/ | | delayed_insert_limit | 100 | | delayed_insert_timeout | 300 | | delayed_queue_size | 1000 | | join_buffer | 131072 | | flush_time | 0 | | key_buffer | 8388600 | | language | /usr/share/mysql/english/ | | log | OFF | | log_update | OFF | | long_query_time | 10 | | low_priority_updates | OFF | | max_allowed_packet | 1048576 | | max_connections | 100 | | max_connect_errors | 10 | | max_delayed_insert_threads | 20 | | max_join_size | 4294967295 | | max_sort_length | 1024 | | net_buffer_length | 16384 | | pid_file | /var/lib/mysql/mysqld.pid | | port | 3306 | | protocol_version | 10 | | record_buffer | 131072 | | skip_locking | ON | | skip_networking | OFF | | socket | /var/lib/mysql/mysql.sock | | sort_buffer | 2097144 | | table_cache | 64 | | thread_stack | 65536 | | tmp_table_size | 1048576 | | tmpdir | /tmp/ | | version | 3.22.25 | | wait_timeout | 28800 | +----------------------------+---------------------------+

To unsubscribe, send a message to: <mysql-unsubscribe-atrus=atru@lists.mysql.com>

--

-------------------------------------------------------------------- Yann Ramin atr@atrustrivalie.eu.org Atrus Trivalie Productions www.atrustrivalie.eu.org irm.it.montereyhigh.com Monterey High IT www.montereyhigh.com ICQ 46805627 AIM oddatrus Marina, CA

"All cats die. Socrates is dead. Therefore Socrates is a cat." - The Logician

# fortune "To be responsive at this time, though I will simply say, and therefore this is a repeat of what I said previously, that which I am unable to offer in response is based on information available to make no such statement."

--------------------------------------------------------------------

To unsubscribe, send a message to: <mysql-unsubscribe-fooler=skyi@lists.mysql.com>