473,770 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1554
Rob

"Chris McAvoy" <mc******@hotma il.com> schreef in bericht
news:73******** *************** ***@posting.goo gle.com...
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******@hotma il.com> schreef in bericht
news:73******** *************** ***@posting.goo gle.com...
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******@hotma il.com> schreef in bericht
news:73******** *************** ***@posting.goo gle.com...
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_gr oup.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_gr oup.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_gr oup.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
2413
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 visitors to my Web site can access my database through my Web site at one time? Or does this mean that in my code I can only use 50 connections? and like
0
1037
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 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?
4
4179
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 Database frequently. Is there any configuration that I will have to do to my server in order to handle the load ? Thank you... I would appreciate answers from someone that already experienced that
1
2567
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 close them as early as possible. My requirement is as follows: I'm developing a class library that will be instantiated by a COM component. My class library contains functions that perform lot of mathematical calculations and read a lot of data...
2
2126
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 up performance logs to log # of pooled database connections on the web server every 60 seconds (.NET CLR Data(_global_)\SqlClient: Current # pooled connections). The # of connections is constantly higher than the # of active ASP.NET sessions....
17
8452
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 using crystal reports 9 and vb.net and we're using the crystalrepotViewer to show our reports. But every time we open a report the connection to or sql server remains, so if I open 5 forms with the report viewer I've got 5 sleeping connections in...
5
5594
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 usage suddently increases to 100 %. Can some one tell me why this is happening.
4
6066
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 confused. So, (I've had a couple of beers), am I opening up too many at once? I'll look again in the morning, but am thinking that it is a bad idea to leave two connections open all the time ...
5
3399
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 left, I always see that there are 2 connections open and in "ESTABLISHED" state. Here is the piece of code that I'm using, please tell where I'm doing it wrong. Since this class is being used at many placed in my actual web based application that...
0
10259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.