Freebsd and RAM

Freebsd 12.2 64G ram

He noticed that when he reached about 30 gig, he began to swap. He tried to complete the memory, created a memory disk and copied the file there 10G. the system hung.

Freed the server and has already created a memory disk in ram 50 gig.

Mem: 26M Active, 35M Inact, 1051M Wired, 40K Buf, 61G Free

write file 10G
see in the top

Mem: 10G Active, 9821M Inact, 1342M Wired, 227M Buf, 42G Free

write second file 10G and look in the top,

Mem: 20G Active, 19G Inact, 1620M Wired, 455M Buf, 22G Free

Add file 3 in 10G? look the top

Mem: 29G Active, 28G Inact, 4476K Laundry, 1846M Wired, 677M Buf, 2989M Free



Where does memory go, maybe who can tell and how to cure it?
 
Work systems htop

1 [|| 4.1%] 7 [||||||||||| 26.4%] 13 [||||||| 17.6%] 19 [||||| 11.4%]
2 [|||| 8.8%] 8 [||||| 12.2%] 14 [||||||||||| 26.9%] 20 [|||||||| 19.2%]
3 [|||| 6.2%] 9 [|||||| 13.5%] 15 [|||||| 13.0%] 21 [||||| 10.7%]
4 [|||||||||| 25.9%] 10 [||||||||||||| 33.5%] 16 [||| 6.5%] 22 [|||| 7.7%]
5 [||||| 11.9%] 11 [||||||||||||||| 37.1%] 17 [||||| 10.9%] 23 [|||| 8.5%]
6 [||||||| 15.9%] 12 [||||||| 17.2%] 18 [|||| 9.7%] 24 [||||||||||||| 32.1%]
Mem[|||||||||||||||||||||||||||||||||||||||||| 22.9G/64.0G] Tasks: 61, 0 thr; 2 running
Swp[|||||||||||||||||||||||||||||| 10.4G/30.0G] Load average: 2.24 2.49 2.65
Uptime: 6 days, 01:14:31
 
I can't make any sense of this. What exactly are you doing and what is running on that system?
 
server used for bhyve
I was doing a test of why memory is not used all
and found out that when using 10Gig memory, free to become less by 10 Gig. Why I can't understand that.
 
and found out that when using 10Gig memory, free to become less by 10 Gig. Why I can't understand that.
You've created a RAM disk, copied 10G to it and are now wondering why there's 10G less free memory? Where did you expect that RAM disk to store its data?
 
I get -20 gigabytes of free memory
and if I copy 20 I get -40 gigabytes of free memory

i write 10G free 40G
write 20G Free 20G
write 30G free 3G
 
 
Most plausible answer: It's written on your RAM disk and in a cache. Caches will make room as soon as the RAM is needed for something else.

So, what problem are you trying to solve?
 
Most plausible answer: It's written on your RAM disk and in a cache. Caches will make room as soon as the RAM is needed for something else.

So, what problem are you trying to solve?
My FreeBSD doesn't use more than 30 gig of memory, about 30gig starts using swap. When trying to clear swapof -a writes that there is no free memory.
 
Having 30G of swap seems excessive to me, I'd suggest to reduce it (maybe around 8G). But then, do you observe any problem in situations with a lot of swap usage? Any performance degradation? Because, if not, just leave it. Leaving things in swap that just aren't needed at the moment and instead using the RAM for caches speeding up I/O is generally a good strategy.
 
You haven't given us a lot of information. For comparison here is my bhyve host, it's currently running 13-STABLE but it was 12-STABLE before, with the same settings:
Code:
root@hosaka:~ # vm list
NAME            DATASTORE  LOADER     CPU  MEMORY  VNC           AUTOSTART  STATE
case            default    bhyveload  4    4096M   -             Yes [4]    Running (2748)
jenkins         default    bhyveload  4    4096M   -             Yes [6]    Running (3269)
kdc             default    none       2    2048M   0.0.0.0:5901  Yes [2]    Running (2178)
lady3jane       default    bhyveload  4    8192M   -             Yes [3]    Running (2488)
debian          stor10k    uefi       2    4096M   -             No         Stopped
fbsd-test       stor10k    bhyveload  2    4096M   -             Yes [13]   Running (5133)
gitlab          stor10k    bhyveload  4    6144M   -             Yes [11]   Running (5081)
gitlab-runner   stor10k    bhyveload  4    4096M   -             Yes [12]   Running (5110)
kibana          stor10k    bhyveload  4    6144M   -             Yes [1]    Running (1975)
plex            stor10k    bhyveload  4    4096M   -             Yes [7]    Running (3779)
riviera         stor10k    bhyveload  2    4096M   -             Yes [10]   Running (4566)
sdgame01        stor10k    bhyveload  4    4096M   -             No         Stopped
tessierashpool  stor10k    bhyveload  2    4096M   -             Yes [5]    Running (3247)
wintermute      stor10k    bhyveload  4    4096M   -             Yes [9]    Running (4303)
Code:
last pid: 24032;  load averages:  3.02,  2.66,  1.96                                                        up 2+13:36:30  12:38:17
59 processes:  1 running, 58 sleeping
CPU:  0.2% user,  0.0% nice, 14.4% system,  0.1% interrupt, 85.3% idle
Mem: 12G Active, 19G Inact, 6452M Laundry, 50G Wired, 5476M Free
ARC: 39G Total, 5812M MFU, 30G MRU, 1056K Anon, 1924M Header, 717M Other
     34G Compressed, 42G Uncompressed, 1.23:1 Ratio
Swap: 16G Total, 72M Used, 16G Free

Are you using ZFS? Then you're going to need to limit vfs.zfs.arc_max:
Code:
root@hosaka:~ # sysctl vfs.zfs.arc_max
vfs.zfs.arc_max: 42949672960
 
Back
Top