Re: Too many open processes??

2006-10-08 Thread Chris Sansom

At 17:37 -0700 7/10/06, Cabbar Duzayak wrote:

I am using mysql_pconnect from PHP to connect to our mysql server.


...


Is there a way to configure mysql so that it will kill a process after
a certain period of idle time, just like Apache does?


I may be barking up the wrong tree here, but as I understand it 
(which is hazily :-) ), mysql_pconnect creates a persistent 
connection, which may not be what you want. Try plain mysql_connect 
instead and see what happens. It's what I always use and it's never 
caused any problems, but then I only deal with small databases 
(certainly compared with some on this list!)...


--
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

It isn't necessary to imagine the world ending in fire or ice -
there are two other possibilities: one is paperwork,
and the other is nostalgia.
   -- Frank Zappa

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



Too many open processes??

2006-10-07 Thread Cabbar Duzayak

I am using mysql_pconnect from PHP to connect to our mysql server.
However, whenever there is a temprorary surge in the number of users,
i.e. concurrent users jump from 30 to 200 for like 5 minutes, Apache
creates 200 processes and after the surge is over, they die
gracefully, and # of processes goes down to ~ 30.

However, this is not the case for MySQL. During the surge, it creates
200 processes and these processes stay there forever (till the next
re-start), even though there are only 20-30 concurrent users after the
surge.

Is there a way to configure mysql so that it will kill a process after
a certain period of idle time, just like Apache does?

Thanks...

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



Re: Too many open processes??

2006-10-07 Thread Dan Nelson
In the last episode (Oct 07), Cabbar Duzayak said:
 I am using mysql_pconnect from PHP to connect to our mysql server.
 However, whenever there is a temprorary surge in the number of users,
 i.e. concurrent users jump from 30 to 200 for like 5 minutes, Apache
 creates 200 processes and after the surge is over, they die
 gracefully, and # of processes goes down to ~ 30.
 
 However, this is not the case for MySQL. During the surge, it creates
 200 processes and these processes stay there forever (till the next
 re-start), even though there are only 20-30 concurrent users after
 the surge.

Mysql doesn't create processes; it creates threads.  You are almost
certainly running an older Linux kernel which implements threads as
processes that share the same memory space.  They don't consume any
memory on their own, so it doesn't really hurt to have a hundred unused
ones.
 
 Is there a way to configure mysql so that it will kill a process
 after a certain period of idle time, just like Apache does?

Each thread represents a client connection.  mysql_pconnect uses a
connection pool which keeps connections open between page loads.  I
assume php will drop unused connections after a time.  Check the docs
to see if there's a timeout you can shorten.  Mysql also will cache a
couple threads after all connections are closed, but it defaults to 4. 
Run SHOW VARIABLES LIKE 'thread_cache_size' to see what your server's
set to.

-- 
Dan Nelson
[EMAIL PROTECTED]

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