Solved Memory related question

Hello,

I have a FreeBSD 10, installation with ZFS root. The system has 2 * 2 core CPU, with 4 GB RAM.

I'm running some Ruby process and MySQL.

I noticed that I was starting to consume swap. I'm concerned that my performance will degrade.

I see that ZFS ARC is utilizing 2.8 GB of RAM(?).

Code:
last pid: 57389;  load averages:  0.40,  0.24,  0.19  up 3+19:48:41  17:41:15
40 processes:  1 running, 37 sleeping, 1 stopped, 1 zombie

Mem: 518M Active, 27M Inact, 3241M Wired, 21M Cache, 119M Free
ARC: 2812M Total, 73M MFU, 2575M MRU, 18K Anon, 40M Header, 124M Other
Swap: 4096M Total, 447M Used, 3648M Free, 10% Inuse

I see from VMstat that page scanner is active

Code:
procs  memory  page  disks  faults  cpu
r b w  avm  fre  flt  re  pi  po  fr  sr da0 da1  in  sy  cs us sy id
0 0 3  3319M  140M  293  0  0  0  373 196  0  0  143  964  843  0  0 99
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  24  199  319  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  15  155  238  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  28  217  321  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  13  199  262  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  18  152  296  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  28  237  294  0  0 100
0 0 3  3319M  140M  0  0  0  0  0 220  0  0  26  159  319  0  0 100

The page scan rate is at 220 (based on my Solaris experience, this is supposed to be bad?)

Here is top -o size output:

Code:
  PID USERNAME  THR PRI NICE  SIZE  RES STATE  C  TIME  WCPU COMMAND
18826 diaspora  16  20  0  663M  170M uwait  2  3:27  0.00% ruby21
  867 mysql  26  20  0  578M 35516K sbwait  3  0:41  0.00% mysqld
18838 diaspora  2  52  0  378M  156M select  0  0:20  0.00% ruby21
18837 diaspora  2  52  0  374M  149M select  1  0:21  0.00% ruby21
18825 diaspora  2  52  0  334M 35988K select  0  0:10  0.00% ruby21
57311 root  3  20  0  166M 29080K kqread  0  0:01  0.00% rtorrent
17360 www  27  20  0  149M  6424K kqread  3  0:19  0.00% httpd
17359 www  27  20  0  149M  6128K kqread  3  0:16  0.00% httpd
17362 www  27  20  0  149M  6040K kqread  1  0:18  0.00% httpd
17358 www  27  20  0  149M  5056K kqread  0  0:13  0.00% httpd
18808 diaspora  3  20  0 90584K  5928K select  2  0:01  0.00% ruby21


The question is: am I really out of memory?
 
I don't think you're really in big trouble yet. But more RAM will improve the situation a lot. ZFS is nice but has a pretty big real memory appetite. Feed it.
 
You might want to tune the maximum amount of memory allowed for ARC to something like 1.5-2GBs. 4GBs of main memory is on the limit where manual tuning may be needed, more than that it's almost never needed. Put this in your /boot/loader.conf and restart (this sets the maximum to 2GBs):

Code:
vfs.zfs.arc_max=2048M
 
Back
Top