NYCPHP Meetup

NYPHP.org

[nycphp-talk] Advice: Too many mysql connections.

Ian Forsyth ian at plusfour.org
Fri Nov 7 22:20:53 EST 2003


Hello,

I need some support.

There is a site I do sys-admin type stuff for, that consistently has 
Too Many MySQL connections. Today, it happened 3 times already.

Here is some info.

Hardware:
Dual Pentium 4, 1.8 GigHz, 40 Gigs SCSI Raid, 512 MB Ram.

Server Software:
Apache 1. 3.27, PHP 4.3.1, MySQL 4.0.12 Max

Here is the my.cnf file.

[mysqld]
bind-address=127.0.0.1
set-variable = ft_min_word_len=2
set-variable = max_connections=300

The developer uses a phplib based database class. On average each 
'page' is using 3 instances of the database class. The connect method 
is using mysql_connect();. The developer is re-working the db class so 
a maximum of instance of the class will be initialized on any page 
load. The site is used book dealer, and relies heavily on the full_text 
indexing of about 100,00 records.

The site gets a lot of traffic. According to webalizer, it gets been 
getting about 20,000 'Visits' a month. There are not any other sites 
running on the computer. It is just this site.

MyQuestions.
What are your opinions regarding 1. Hardware, is there enough ram on 
the box to handle increasing the 'max_connections' to 500. 2. Which 
my-*.cnf should we be using. Everything is basically the defaults.. 
Here is a link to the results of the show variables.

http://plusfour.org/mysqlVariables.txt

2. At what point do i give the my-large.cnf a try.. how can I test it.. 
3. What are the pear classes for load testing?

Thanks for any suggestions.

Ian




More information about the talk mailing list