Now then. I come, cap in hand, begging for wisdom.
Got an OpenBSD 4.5 server running mysql 5.0.77
4GB RAM, Quad core server, apparently a Quad core optimised kernel.
Server runs apache with average 100 child threads of c. 3MB memory size.
Load averages of around 1.5 to 2.2
single database of c. 40 innodb tables, optimised reasonably well I think - spent a long time on DESCRIBEing queries and index creation. Tables vary between 10s of rows and a few hundred thousand rows
This is a master replicator to a slave on another box.
Sounds lovely, I hear you say! What’s the problem.
Server keeps dying. kernel panics etc.
We think we have narrowed it down to mysql throwing it’s toys out of the pram.
One thing that is frustrating me is the memory allocation - I cannot get mysql to run with any more than 500M in innodb_buffer_pool_size
mysql runs under its own login class that has unlimited in most things. open file limits raised etc.
in ‘top’ mysqld has a SIZE fo 597 and RES of 167M at the mo.
load averages: 2.58, 2.13, 1.81 09:49:50
90 processes: 88 idle, 1 zombie, 1 on processor
CPU0 states: 3.1% user, 0.0% nice, 0.2% system, 0.2% interrupt, 96.6% idle
CPU1 states: 1.0% user, 0.0% nice, 0.2% system, 0.0% interrupt, 98.8% idle
CPU2 states: 0.9% user, 0.0% nice, 0.1% system, 0.0% interrupt, 99.0% idle
CPU3 states: 1.1% user, 0.0% nice, 0.1% system, 0.0% interrupt, 98.8% idle
Memory: Real: 246M/631M act/tot Free: 2637M Swap: 0K/8197M used/tot
PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND
20231 www 2 0 3116K 7224K sleep/0 netio 0:36 15.53% httpd
12468 www 2 0 3072K 6924K sleep/2 netio 0:05 9.62% httpd
10238 www 2 0 5164K 8888K sleep/1 netio 0:02 9.62% httpd
28535 www 2 0 3064K 6972K sleep/2 netio 0:05 5.57% httpd
16214 _mysql -5 0 596M 167M sleep/1 biowait 3:35 3.86% mysqld
8610 www 2 0 3068K 6972K sleep/0 netio 0:05 2.44% httpd
31817 www 14 0 3124K 7224K sleep/0 semwait 0:22 1.27% httpd
14080 www 2 0 3116K 7216K sleep/3 netio 1:11 0.88% httpd
20649 www 2 0 3080K 6836K sleep/0 netio 0:04 0.78% httpd
11235 www 2 0 3092K 7132K sleep/0 netio 0:22 0.34% httpd
31011 www 2 0 3160K 7196K sleep/1 netio 1:11 0.29% httpd
23481 www 2 0 3108K 7164K sleep/2 netio 1:06 0.29% httpd
1739 www 2 0 3156K 7160K sleep/0 netio 1:03 0.29% httpd
22003 www 2 0 3176K 7308K sleep/1 netio 0:36 0.29% httpd
16152 www 2 0 3068K 6960K sleep/2 netio 0:02 0.29% httpd
28311 www 2 0 3088K 7012K sleep/3 netio 0:29 0.24% httpd
23577 www 2 0 3184K 7280K sleep/3 netio 1:51 0.20% httpd
27084 www 2 0 3068K 6900K sleep/1 netio 0:03 0.15% httpd
20888 www 2 0 3164K 7204K sleep/3 netio 1:12 0.05% httpd
7775 www 2 0 3100K 7024K sleep/2 netio 0:12 0.05% httpd
30141 www 2 0 3068K 6948K sleep/3 netio 0:00 0.05% httpd
9379 www 14 0 3144K 7104K sleep/1 semwait 1:43 0.00% httpd
21090 www 14 0 3160K 7200K sleep/0 semwait 1:28 0.00% httpd
44 www 2 0 3124K 7004K sleep/1 netio 1:23 0.00% httpd
11830 www 2 0 3136K 7168K sleep/1 netio 1:15 0.00% httpd
21924 www 2 0 3148K 7116K sleep/3 netio 1:11 0.00% httpd
24841 www 2 0 3164K 7188K sleep/0 netio 1:09 0.00% httpd
31528 www 14 0 3140K 7156K sleep/2 semwait 1:09 0.00% httpd
19097 www 2 0 3116K 7128K sleep/1 netio 1:05 0.00% httpd
16381 www 14 0 3168K 7376K sleep/2 semwait 1:03 0.00% httpd
21046 www 2 0 3120K 7232K sleep/0 netio 0:53 0.00% httpd
15623 www 2 0 3112K 6976K sleep/1 netio 0:50 0.00% httpd
25203 www 2 0 3136K 7072K sleep/0 netio 0:49 0.00% httpd
8439 www 2 0 3132K 7036K sleep/2 netio 0:49 0.00% httpd
Sometimes server just drops, sometimes starts refusing mysql queries complaining about memory allocations for a query.
Example MySQL config file for medium systems.
This is for a system with little memory (32M - 64M) where MySQL plays
an important part, or systems up to 128M where MySQL is used together with
other programs (such as a web server)
You can copy this file to
/etc/my.cnf to set global options,
mysql-data-dir/my.cnf to set server-specific options (in this
installation this directory is /var/mysql) or
~/.my.cnf to set user-specific options.
In this file, you can use all long options that a program supports.
If you want to know which options a program supports, run the program
with the “–help” option.
The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/www/var/run/mysql/mysql.sock
Here follows entries for some specific programs
The MySQL server
[mysqld]
port = 3306
socket = /var/www/var/run/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
Don’t listen on a TCP/IP port at all. This can be a security enhancement,
if all processes that need to connect to mysqld run on the same host.
All interaction with mysqld must be made via Unix sockets or named pipes.
Note that using this option without enabling named pipes on Windows
my.cnf: unmodified, readonly: line 1
Anyone any suggestions.
Prizes for spotting the most stupid error first. )
TIA
M.