List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 23 2001 5:28am
Subject:Re: does each database connect cause mysqld to fork?
View as plain text  
At 7:14 PM -0800 11/21/01, Bennett Haselton wrote:
>Each time I open a database handle (in perl code), does that cause a 
>new process to run, a new instance of mysqld?  And each time I 
>disconnect the database handle ($dbh->disconnect() in perl code), 
>does that cause the number of running instances of mysqld to go down 
>by one?

This is explained in the manual.

http://www.mysql.com/doc/L/i/Linux.html says:

When using LinuxThreads you will see a minimum of three processes
running. These are in fact threads. There will be one thread for the
LinuxThreads manager, one thread to handle connections, and one
thread to handle alarms and signals.


So what you're seeing is the way Linux reports threads as processes.

>
>The process list on my Linux server includes several instances of mysqld:
>
>server1:/home/bhaselto/web/html$ ps auwx | grep mysqld
>root      1014  0.0  0.0  1672    0 ?        SW   Nov05   0:00 [safe_mysqld]
>mysql     1037  0.0  3.6 15172 9484 ?        S    Nov05  22:10 
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     1039  0.0  3.6 15172 9484 ?        R    Nov05  19:02 
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     1040  0.0  3.6 15172 9484 ?        S    Nov05   0:04 
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>mysql     4518  0.0  0.0     0    0 ?        Z    21:07   0:00 
>[mysqld <defunct>]
>mysql     4519  0.0  3.6 15172 9484 ?        R    21:07   0:00 
>/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --
>
>so I was wondering if that was the explanation -- I know I have 
>multiple running scripts that use the database at the same time, 
>although I thought they generally didn't leave the handles open that 
>long.
>
>	-Bennett
>
>bennett@stripped     http://www.peacefire.org
>(425) 649 9024

Thread
does each database connect cause mysqld to fork?Bennett Haselton22 Nov
  • Re: does each database connect cause mysqld to fork?Paul DuBois23 Nov
RE: does each database connect cause mysqld to fork?Quentin Bennett22 Nov
  • RE: does each database connect cause mysqld to fork?Bennett Haselton22 Nov
    • Re: does each database connect cause mysqld to fork?Dan Nelson22 Nov