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]

Reply via email to