473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Who is taking all of my connections?

Hi,

Every morning around 11am, we run out of database connections. We
have one user, and a bunch of scripts that use that account to connect
to the database. I believe we have a bad script out there that's
routinely chewing up our available connections. I plan on turning on
as much logging as possible tonight. Are there any other tools out
there that can help me figure out exactly which script is generating
the connections?

Thanks,
Chris
Jul 20 '05 #1
6 1536
Rob

"Chris McAvoy" <mc******@hotmail.com> schreef in bericht
news:73**************************@posting.google.c om...
Hi,

Every morning around 11am, we run out of database connections. We
have one user, and a bunch of scripts that use that account to connect
to the database. I believe we have a bad script out there that's
routinely chewing up our available connections. I plan on turning on
as much logging as possible tonight. Are there any other tools out
there that can help me figure out exactly which script is generating
the connections?

Thanks,
Chris


Hello Chris,

I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly. Then read the information about persistent connection and determine
if you really need such a connection. Maybe mysql_connect() is all you need
and changing mysql_pconnect to mysql_connect solves your problem.

More information :

http://www.mysql.com/news-and-events...000000086.html

http://nl.php.net/manual/en/features...onnections.php

I hope this helps to solve the problem
Rob
Jul 20 '05 #2
Rob

"Chris McAvoy" <mc******@hotmail.com> schreef in bericht
news:73**************************@posting.google.c om...
Hi,

Every morning around 11am, we run out of database connections. We
have one user, and a bunch of scripts that use that account to connect
to the database. I believe we have a bad script out there that's
routinely chewing up our available connections. I plan on turning on
as much logging as possible tonight. Are there any other tools out
there that can help me figure out exactly which script is generating
the connections?

Thanks,
Chris


Hello Chris,

I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly. Then read the information about persistent connection and determine
if you really need such a connection. Maybe mysql_connect() is all you need
and changing mysql_pconnect to mysql_connect solves your problem.

More information :

http://www.mysql.com/news-and-events...000000086.html

http://nl.php.net/manual/en/features...onnections.php

I hope this helps to solve the problem
Rob
Jul 20 '05 #3
Rob

"Chris McAvoy" <mc******@hotmail.com> schreef in bericht
news:73**************************@posting.google.c om...
Hi,

Every morning around 11am, we run out of database connections. We
have one user, and a bunch of scripts that use that account to connect
to the database. I believe we have a bad script out there that's
routinely chewing up our available connections. I plan on turning on
as much logging as possible tonight. Are there any other tools out
there that can help me figure out exactly which script is generating
the connections?

Thanks,
Chris


Hello Chris,

I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly. Then read the information about persistent connection and determine
if you really need such a connection. Maybe mysql_connect() is all you need
and changing mysql_pconnect to mysql_connect solves your problem.

More information :

http://www.mysql.com/news-and-events...000000086.html

http://nl.php.net/manual/en/features...onnections.php

I hope this helps to solve the problem
Rob
Jul 20 '05 #4
Hi Rob, thanks for your response.

"Rob" <reply_@news_group.please> wrote
I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly.


We definitly had some issues with pconnect vs. connect. We removed
all the pconnects we found, and still had the issue. We ended up
moving out of our shared environment to a dedicated host. Since then,
we've continued to have the issue. I turned off persistence in
php.ini, and we still have the problem.

After turning on query logging, I see that the processes that go to
sleep aren't consistent, as in, they're very common queries, and there
doesn't appear to be an obvious pattern to them.

It seems like during times of high stress, either PHP or mysql isn't
releasing open connections efficiently. We don't explicitly close
connections, which _shouldn't_ be a big deal, but it appears that it
may be.

My current thinking is this, we have a lot of scripts, and sometimes
we'll unneccessarily mysql_connect, even though the script is really
only being included in another file that has an existing
mysql_connect. The second, unnecessary, mysql_connect isn't closed.

In the log file, the connections sleep for a while, and then they're
all closed in one big shot.

Our primary application is PHPBB. Before we left the shared host,
they stated that several PHPBB sites were having similar issues.

As a workaround, I've increased max_connections from 100 to 500. I
think we'll be stable for a while, but I'd really like to clean it up
for good.

I know this is a MySQL group, and not a PHP group. If this is an
inappropriate post, let me know, and I'll move along.

Thanks very much,
Chris
Jul 20 '05 #5
Hi Rob, thanks for your response.

"Rob" <reply_@news_group.please> wrote
I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly.


We definitly had some issues with pconnect vs. connect. We removed
all the pconnects we found, and still had the issue. We ended up
moving out of our shared environment to a dedicated host. Since then,
we've continued to have the issue. I turned off persistence in
php.ini, and we still have the problem.

After turning on query logging, I see that the processes that go to
sleep aren't consistent, as in, they're very common queries, and there
doesn't appear to be an obvious pattern to them.

It seems like during times of high stress, either PHP or mysql isn't
releasing open connections efficiently. We don't explicitly close
connections, which _shouldn't_ be a big deal, but it appears that it
may be.

My current thinking is this, we have a lot of scripts, and sometimes
we'll unneccessarily mysql_connect, even though the script is really
only being included in another file that has an existing
mysql_connect. The second, unnecessary, mysql_connect isn't closed.

In the log file, the connections sleep for a while, and then they're
all closed in one big shot.

Our primary application is PHPBB. Before we left the shared host,
they stated that several PHPBB sites were having similar issues.

As a workaround, I've increased max_connections from 100 to 500. I
think we'll be stable for a while, but I'd really like to clean it up
for good.

I know this is a MySQL group, and not a PHP group. If this is an
inappropriate post, let me know, and I'll move along.

Thanks very much,
Chris
Jul 20 '05 #6
Hi Rob, thanks for your response.

"Rob" <reply_@news_group.please> wrote
I do not know of such tools.
But you can start to do a "find in all files" with a editor that support
this functionality and look for the use of the function mysql_pconnect().
Because if you use persistent connections (mysql_pconnect) it is possible
that some connections are not closed properly and your script is creating
new ones when ever it is run. This will exceed your connections limit
rapidly.


We definitly had some issues with pconnect vs. connect. We removed
all the pconnects we found, and still had the issue. We ended up
moving out of our shared environment to a dedicated host. Since then,
we've continued to have the issue. I turned off persistence in
php.ini, and we still have the problem.

After turning on query logging, I see that the processes that go to
sleep aren't consistent, as in, they're very common queries, and there
doesn't appear to be an obvious pattern to them.

It seems like during times of high stress, either PHP or mysql isn't
releasing open connections efficiently. We don't explicitly close
connections, which _shouldn't_ be a big deal, but it appears that it
may be.

My current thinking is this, we have a lot of scripts, and sometimes
we'll unneccessarily mysql_connect, even though the script is really
only being included in another file that has an existing
mysql_connect. The second, unnecessary, mysql_connect isn't closed.

In the log file, the connections sleep for a while, and then they're
all closed in one big shot.

Our primary application is PHPBB. Before we left the shared host,
they stated that several PHPBB sites were having similar issues.

As a workaround, I've increased max_connections from 100 to 500. I
think we'll be stable for a while, but I'd really like to clean it up
for good.

I know this is a MySQL group, and not a PHP group. If this is an
inappropriate post, let me know, and I'll move along.

Thanks very much,
Chris
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
0
by: Chris McAvoy | last post by:
Hi, Every morning around 11am, we run out of database connections. We have one user, and a bunch of scripts that use that account to connect to the database. I believe we have a bad script out...
4
by: Angelos | last post by:
I get this error mysql_pconnect Too many connections ... every now and then. Does anyone knows where it comes from ? There are a lot of sites running on the server and all of them use the...
1
by: C Sharp beginner | last post by:
I'm sorry about this verbose posting. This is a follow-up to my yesterday's posting. Thanks William for your reply. I understand it is a good practice to open connections as late as possible and...
2
by: Bob | last post by:
We have a production web site that's data intensive (save user input to DB and query for displaying) with the ASP.NET app part on one W2K server and SQL 2000 DB on another W2K server. I have set...
17
by: Peter Proost | last post by:
Hi Group, I've got an interesting problem, I don't know if this is the right group but I think so because everything I've read about it so far says it's a .net problem. Here's the problem, we're...
5
by: archana | last post by:
Hi all i am having application which is using asychronous web request. At a time i am processing 5 urls asynchronously. Application working properly for 5 asynchronous call. But sometimes CPU...
4
by: elyob | last post by:
Not really tried going two ways at once, but I have an include_once connection to a mysql_database, now I need to retrieve info from a second mysql_database .. My mysql_connects are getting...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.