PHP and pconnect

2002-02-12 Thread Simon Windsor

Hi

The I have noticed that the number of Aborted Clients and Aborted 
Connections has increased sharply recently on our two production 
servers, but not on our development server.

Yesterday we started getting a number of blocked host errors, which we 
had to clear up with flush hosts.

http://www.mysql.com/doc/B/l/Blocked_host.html

This morining, I increased the max_connect_errors from 10 to 1, and 
the problem has thankfully disappeared.

I know that this hides the problem, but I am at a loss to explain the cause.

The favourite causes are

- use of mysql_pconnect (introduced in Novemeber)
- use of fsockopen($Primary, 3306, $errno,$errstr,5) (closed by 
fclose()) to test if connection possible before attempting connection 
(introduced last week)
- much high web activity causing recycling of httpd processes

mysql_pconnect was used to improve performance, and reduce load -- it works
fsockopen is used to determine if the web process should use the local, 
or remote database.

Can anyone shed any light on the causes of Aborted Clients and Connects, 
and whether mysql_pconnect and fsockopen would have an effect ?

Simon


-
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


-
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




PHP and pconnect

2002-02-05 Thread Simon Windsor

Hi

The I have noticed that the number of Aborted Clients and Aborted 
Connections has increased sharply recently on our two production 
servers, but not on our development server.

Yesterday we started getting a number of blocked host errors, which we 
had to clear up with flush hosts.

http://www.mysql.com/doc/B/l/Blocked_host.html

This morining, I increased the max_connect_errors from 10 to 1, and 
the problem has thankfully disappeared.

I know that this hides the problem, but I am at a loss to explain the cause.

The favourite causes are

- use of mysql_pconnect (introduced in Novemeber)
- use of fsockopen($Primary, 3306, $errno,$errstr,5) (closed by 
fclose()) to test if connection possible before attempting connection 
(introduced last week)
- much high web activity causing recycling of httpd processes

mysql_pconnect was used to improve performance, and reduce load -- it works
fsockopen is used to determine if the web process should use the local, 
or remote database.

Can anyone shed any light on the causes of Aborted Clients and Connects, 
and whether mysql_pconnect and fsockopen would have an effect ?

Simon


-
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




Re: PHP and pconnect

2002-02-05 Thread David Phillips

 - use of mysql_pconnect (introduced in Novemeber)
 - use of fsockopen($Primary, 3306, $errno,$errstr,5) (closed by
 fclose()) to test if connection possible before attempting connection
 (introduced last week)
 - much high web activity causing recycling of httpd processes

You're putting more load on everything by opening the connection with
fsockopen.  Simply do the following:

$db = @mysql_pconnect(...);
if (!$db)
  die(connection failed);

 Can anyone shed any light on the causes of Aborted Clients and Connects,
 and whether mysql_pconnect and fsockopen would have an effect ?

I'd guess your fsockopen calls are causing Aborted Clients to rise.  If you
still have problems after fixing that, then my first idea would be that PHP
does not clean up properly when a client aborts the page by pressing the
stop button.  This would be rather easy to test.

If you're using Apache, you can also try setting MaxRequestsPerChild to
something like 1, so that after a while the process will die and
hopefully close any open connections to the MySQL server.  Or if you're
already doing this, try disabling it and seeing if it helps.



-
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