mysql open connections question

2005-02-28 Thread Scott Purcell
Hello,
 
I am writing a web-based application and incorporated a roll-your-own database 
pool into it. So far I am running well, but I have seen a couple of issues I 
would like to present.
 
After being up for a couple of days, I noticed a Error cannot connect, too 
many connections error coming from Tomcat.
So I would like to understand how to find out the following:
How many connections are being used now?
How much memory is mysql consuming?
Do I have everything configured properly.
 
I am concerned that maybe I have  problem with my connection class, so it would 
be nice to create a connection, (check out how many connections are used) 
return it, and check again, to see if I screwed something up.
 
Any help in this regards would be appreciated.
 
Sincerely
Scott
 


Re: mysql open connections question

2005-02-28 Thread Michael Dykman
On Mon, 2005-02-28 at 14:42, Scott Purcell wrote:
Hi!

you haven't mentioned your OS so some of these items will be a guess at
how _you_ would actually do it..  I'm basing this on Linux or any modern
*nix OS.


 Hello,
  
 I am writing a web-based application and incorporated a roll-your-own 
 database pool into it. So far I am running well, but I have seen a couple of 
 issues I would like to present.
  
 After being up for a couple of days, I noticed a Error cannot connect, too 
 many connections error coming from Tomcat.
 So I would like to understand how to find out the following:
 How many connections are being used now?
at the mysql prompt (from the console or any admin application) 
mysql show processlist;
 How much memory is mysql consuming?
assuming your mysqld runs as user root.
from the shell, try $ top -u mysql

 Do I have everything configured properly.
  
 I am concerned that maybe I have  problem with my connection class, so it 
 would be nice to create a connection, (check out how many connections are 
 used) return it, and check again, to see if I screwed something up.
It suggests your connection class is not letting go of open
connections.  May out some instrumentation into it so you can keep
track. Your pool might also want some check for stale connections or,
more wisely I think, the ability to close connections which have not
been used for a certain period of time (5-10 minutes?)

You can configure the number of connections which MySQL will accept in
your my.cnf file with
max_connections = 500 
# or whatever value you like..  each connection does cost resources
though (RAM, file handles) so don't treat this like it's unlimited.  The
default is 100; it's maximum is 4000 with static binaries provided by 
MySQL AB.

-- 
 - michael dykman
 - [EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]