MySQL uses swap with plenty of RAM available

MySQL uses swap with plenty of RAM available

am 18.01.2007 01:06:59 von Aaron

Output of "top" prior to initiation of mysql:

load averages: 0.60, 0.97, 1.05
19:03:45
44 processes: 43 sleeping, 1 on cpu
CPU states: 97.1% idle, 0.0% user, 0.8% kernel, 2.1% iowait, 0.0%
swap
Memory: 4096M real, 3646M free, 42M swap in use, 3494M swap free

PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
10709 agibson 14 58 0 5824K 4384K sleep 4:11 0.06% rtgpoll
10705 agibson 14 58 0 5808K 4368K sleep 3:58 0.06% rtgpoll
12002 jscript 1 58 0 2288K 1440K cpu0 0:00 0.06% top
10706 agibson 15 58 0 5632K 4192K sleep 3:24 0.05% rtgpoll
10708 agibson 15 58 0 5520K 4072K sleep 2:57 0.05% rtgpoll
10707 agibson 15 58 0 5544K 4088K sleep 3:00 0.05% rtgpoll
10845 jscript 1 48 0 2504K 1784K sleep 0:00 0.01% bash
72 root 15 21 0 6896K 6152K sleep 0:23 0.00% picld
11980 root 1 48 0 336K 232K sleep 0:00 0.00% sh
11895 agibson 1 58 0 6632K 1904K sleep 0:00 0.00% sshd
11981 root 1 58 0 2504K 1760K sleep 0:00 0.00% bash
228 root 1 48 0 1752K 968K sleep 0:01 0.00% prngd
1070 root 1 18 0 336K 232K sleep 0:00 0.00% sh
179 root 1 32 0 1776K 920K sleep 0:00 0.00% sf880drd
11893 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd


Output of top immediately after starting mysql:

load averages: 0.29, 0.80, 0.99
19:04:50
46 processes: 45 sleeping, 1 on cpu
CPU states: 98.8% idle, 0.0% user, 1.1% kernel, 0.1% iowait, 0.0%
swap
Memory: 4096M real, 3378M free, 2142M swap in use, 1394M swap free

PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
12037 mysql 11 0 0 2107M 268M sleep 0:00 1.53% mysqld
10705 agibson 14 58 0 5808K 4368K sleep 3:59 1.35% rtgpoll
10709 agibson 14 58 0 5824K 4384K sleep 4:12 1.30% rtgpoll
10707 agibson 15 58 0 5544K 4088K sleep 3:00 0.96% rtgpoll
10708 agibson 15 58 0 5520K 4072K sleep 2:58 0.96% rtgpoll
10706 agibson 15 58 0 5632K 4200K sleep 3:25 0.93% rtgpoll
12013 root 1 0 0 1080K 784K sleep 0:00 0.03% mysqld_safe
72 root 15 21 0 6896K 6152K sleep 0:23 0.03% picld
228 root 1 48 0 1752K 968K sleep 0:01 0.00% prngd
12002 jscript 1 58 0 2288K 1440K cpu0 0:00 0.00% top
1070 root 1 18 0 336K 232K sleep 0:00 0.00% sh
179 root 1 32 0 1776K 920K sleep 0:00 0.00% sf880drd
10823 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd
11893 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd
1055 root 1 38 0 6632K 2776K sleep 0:00 0.00% sshd

Over 75% of the RAM is showing as available yet MySQL uses 2Gigs of
swap rather than the available 3 Gigs of real memory?!?!?

Re: MySQL uses swap with plenty of RAM available

am 19.01.2007 04:53:29 von Michael Austin

aaron wrote:

> Output of "top" prior to initiation of mysql:
>
> load averages: 0.60, 0.97, 1.05
> 19:03:45
> 44 processes: 43 sleeping, 1 on cpu
> CPU states: 97.1% idle, 0.0% user, 0.8% kernel, 2.1% iowait, 0.0%
> swap
> Memory: 4096M real, 3646M free, 42M swap in use, 3494M swap free
>
> PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
> 10709 agibson 14 58 0 5824K 4384K sleep 4:11 0.06% rtgpoll
> 10705 agibson 14 58 0 5808K 4368K sleep 3:58 0.06% rtgpoll
> 12002 jscript 1 58 0 2288K 1440K cpu0 0:00 0.06% top
> 10706 agibson 15 58 0 5632K 4192K sleep 3:24 0.05% rtgpoll
> 10708 agibson 15 58 0 5520K 4072K sleep 2:57 0.05% rtgpoll
> 10707 agibson 15 58 0 5544K 4088K sleep 3:00 0.05% rtgpoll
> 10845 jscript 1 48 0 2504K 1784K sleep 0:00 0.01% bash
> 72 root 15 21 0 6896K 6152K sleep 0:23 0.00% picld
> 11980 root 1 48 0 336K 232K sleep 0:00 0.00% sh
> 11895 agibson 1 58 0 6632K 1904K sleep 0:00 0.00% sshd
> 11981 root 1 58 0 2504K 1760K sleep 0:00 0.00% bash
> 228 root 1 48 0 1752K 968K sleep 0:01 0.00% prngd
> 1070 root 1 18 0 336K 232K sleep 0:00 0.00% sh
> 179 root 1 32 0 1776K 920K sleep 0:00 0.00% sf880drd
> 11893 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd
>
>
> Output of top immediately after starting mysql:
>
> load averages: 0.29, 0.80, 0.99
> 19:04:50
> 46 processes: 45 sleeping, 1 on cpu
> CPU states: 98.8% idle, 0.0% user, 1.1% kernel, 0.1% iowait, 0.0%
> swap
> Memory: 4096M real, 3378M free, 2142M swap in use, 1394M swap free
>
> PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
> 12037 mysql 11 0 0 2107M 268M sleep 0:00 1.53% mysqld
> 10705 agibson 14 58 0 5808K 4368K sleep 3:59 1.35% rtgpoll
> 10709 agibson 14 58 0 5824K 4384K sleep 4:12 1.30% rtgpoll
> 10707 agibson 15 58 0 5544K 4088K sleep 3:00 0.96% rtgpoll
> 10708 agibson 15 58 0 5520K 4072K sleep 2:58 0.96% rtgpoll
> 10706 agibson 15 58 0 5632K 4200K sleep 3:25 0.93% rtgpoll
> 12013 root 1 0 0 1080K 784K sleep 0:00 0.03% mysqld_safe
> 72 root 15 21 0 6896K 6152K sleep 0:23 0.03% picld
> 228 root 1 48 0 1752K 968K sleep 0:01 0.00% prngd
> 12002 jscript 1 58 0 2288K 1440K cpu0 0:00 0.00% top
> 1070 root 1 18 0 336K 232K sleep 0:00 0.00% sh
> 179 root 1 32 0 1776K 920K sleep 0:00 0.00% sf880drd
> 10823 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd
> 11893 root 1 38 0 7024K 3248K sleep 0:00 0.00% sshd
> 1055 root 1 38 0 6632K 2776K sleep 0:00 0.00% sshd
>
> Over 75% of the RAM is showing as available yet MySQL uses 2Gigs of
> swap rather than the available 3 Gigs of real memory?!?!?
>

mysql will only use as much physical memory as you have configured it to use....

Start here:
http://dev.mysql.com/doc/refman/5.0/en/optimizing-the-server .html
http://dev.mysql.com/doc/refman/5.0/en/memory-use.html
http://dev.mysql.com/doc/refman/5.0/en/server-parameters.htm l

--
Michael Austin
Database Consultant
Domain Registration and Linux/Windows Web Hosting Reseller
http://www.spacelots.com