Bug #16885 MySQL 3.23.58 under Fedora fails to support multi-processors...
Submitted: 29 Jan 2006 22:53 Modified: 9 Feb 2006 13:15
Reporter: Ryan Barclay Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S5 (Performance)
Version:3.23.58 OS:Linux (Linux - Fedora Core 2)
Assigned to: CPU Architecture:Any

[29 Jan 2006 22:53] Ryan Barclay
Description:
I'm running MySQL 3.23.58 with Fedora core 2 on a Dual Xeon system.  I have quite a few busy websites that use the MySQL server, and noticed that my version of MySQL only runs one instance and uses 99% of the CPU that it's running on at peak times and only on one CPU with one instance.

I would like to get several instances of MySQL running, like my apache does for PHP pages in module mode. Is it possible?

I've tried adding the "thread_concurrency" setting to my my.cnf but after that MySQL fails to start.

Here is a dump of the top command:

---------------
[root@web2 root]# top

 22:53:22  up 4 days,  5:09,  1 user,  load average: 1.37, 1.68, 1.94
146 processes: 136 sleeping, 7 running, 3 zombie, 0 stopped
CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
           total  142.0%    0.0%   58.0%   0.0%     0.0%    0.0%  199.2%
           cpu00   33.5%    0.0%   14.7%   0.0%     0.0%    0.0%   51.6%
           cpu01   33.5%    0.0%   12.6%   0.0%     0.0%    0.0%   53.7%
           cpu02   37.0%    0.0%   15.8%   0.0%     0.0%    0.0%   47.1%
           cpu03   38.1%    0.0%   14.9%   0.0%     0.0%    0.0%   46.9%
Mem:  2068368k av, 1906936k used,  161432k free,       0k shrd,   98068k buff
       901784k active,             897116k inactive
Swap: 4096532k av,   62336k used, 4034196k free                 1317276k cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
11717 mysql     15   0 17432  17M  2648 S    70.2  0.8  81:41   2 mysqld
23657 root      17   0  1260 1260   820 R     1.7  0.0   0:00   1 top
 2177 root      16   0 10660 1148  1072 S     0.3  0.0   0:42   0 MailScanner
   22 root      15   0     0    0     0 SW    0.1  0.0   5:44   0 kjournald
  638 root      15   0     0    0     0 SW    0.1  0.0  11:14   3 kjournald
  639 root      15   0     0    0     0 SW    0.1  0.0   6:29   1 kjournald
12088 root      15   0   920  920   520 S     0.1  0.0   0:10   1 exclog
    1 root      16   0   400  364   348 S     0.0  0.0   0:12   0 init
    2 root      RT   0     0    0     0 SW    0.0  0.0   0:00   0 swapper
    3 root      RT   0     0    0     0 SW    0.0  0.0   0:00   1 swapper
    4 root      RT   0     0    0     0 SW    0.0  0.0   0:00   2 swapper
    5 root      RT   0     0    0     0 SW    0.0  0.0   0:00   3 swapper
    6 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 keventd
    7 root      34  19     0    0     0 SWN   0.0  0.0   0:01   0 ksoftirqd/0
    8 root      34  19     0    0     0 SWN   0.0  0.0   0:00   1 ksoftirqd/1
    9 root      34  19     0    0     0 SWN   0.0  0.0   0:00   2 ksoftirqd/2
   10 root      34  19     0    0     0 SWN   0.0  0.0   0:00   3 ksoftirqd/3
   12 root      25   0     0    0     0 SW    0.0  0.0   0:00   0 bdflush
   11 root      15   0     0    0     0 SW    0.0  0.0   2:02   3 kswapd
   13 root      15   0     0    0     0 SW    0.0  0.0   3:49   1 kupdated
   14 root      25   0     0    0     0 SW    0.0  0.0   0:00   0 mdrecoveryd
   73 root      17   0     0    0     0 SW    0.0  0.0   0:00   0 khubd
  637 root      16   0     0    0     0 SW    0.0  0.0   0:00   3 kjournald
 1714 root      16   0   360  352   300 S     0.0  0.0   0:17   1 irqbalance
 1797 root      16   0   576  552   532 S     0.0  0.0   0:22   0 syslogd

----

I have included the first part of the top command.  There is only ONE instance of mysqld running, even in the text not included above.

How to repeat:
Add the "thread_concurrency" setting to my my.cnf but after that MySQL fails to start.
[30 Jan 2006 9:29] Valeriy Kravchuk
Thank you for a problem report. MySQL server is a single multi-threaded process. So, the task to spread its threads over processors is up to the OS scheduler.

Please, send the my.cnf file content that leads to failure upon startup.
[30 Jan 2006 12:28] Ryan Barclay
Thanks for the reply.  Here is my my.cnf:

-------------
[root@web2 root]# tail /etc/my.cnf

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/home/virtual/FILESYSTEMTEMPLATE/.mysqlsock/mysql.sock
-------------

When I add the line "thread_concurrency = 4" or any other number, MySQL service fails to start.
[9 Feb 2006 13:15] Valeriy Kravchuk
If you want to set thread_concurrency, do it properly, according to the manual of version 3.23 (http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html etc.):

openxs@suse:~/dbs/3.23> cat var/my.cnf
[mysqld]
set-variable = thread_concurrency=4

With this setting your 3.23.58 will start successfully, although, this server variable has a default value of 10 and it seems it is ignored on Linux (used for Solaris).

Your "top" results show that all your 4 CPUs are equally loaded and used, so I see no evidence of not supporting multiple CPUs in this report.