Greetings:

I haven't seen any discussions on reducing the duration of a network connection
on port 3306 after issuing a mysql_close, so it makes sense to inquire whether
anyone has addressed this.

The code follows:
// main.c
#include <mysql.h>
if ((conn = do_connect (BTIME_HOST, USER, BTIME_PW, BTIME_DB, 0, NULL, 0)) ==
0);
// trivial processing of a quick insert, or update; no output
mysql_close (conn);

do_connect does the usual, such as mysql_init(), and some error checking
(trivial), then, passes back:
return(conn) on success.

My question (probably best addressed by someone with intimate knowledge of the
mysql_close code) is that while testing, I found the connection stays present
for about a minute:

vanboers@sedona:~$ while true; do date; netstat -tn | grep 3306; sleep 1; done
Mon Jun  4 23:55:52 MST 2001
tcp        0      0 192.168.1.12:38012      192.168.1.14:3306       TIME_WAIT
<snipped>
Mon Jun  4 23:56:52 MST 2001
tcp        0      0 192.168.1.12:38012      192.168.1.14:3306       TIME_WAIT
Mon Jun  4 23:56:53 MST 2001
Mon Jun  4 23:56:54 MST 2001

It's not a big deal, but, the question remains that, if the connection has been
closed (meaning processing is complete), then, there should be no reason for the
network connection to remain in TIME_WAIT state.

The application in question has potential to create a large volume of such
connections on an ongoing basis, and, particularly at times when there is high
volume of logging in and logging out of the network at large (i.e. 9 am, 12pm,
1pm, 5pm), which could become an issue on available connections depending on
scale and installation base.

Perhaps this is more a function of the 2.4.5 linux kernel TCP code, than
mysql_close, but, I'm not aware of any such 60 second implementation in the
kernel code.

If this is a MySQL issue, please advise.  I've no problem with disseminating the
full source to any interested party.

Best Regards,
Van
-- 
=========================================================================
Linux rocks!!!   http://www.dedserius.com
=========================================================================

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to