ram usage

coyote_zed

Member

Reaction score: 2
Messages: 58

I am new to FreeBSD and have recently installed it on my Laptop that has 16 Gb of ram. I chose to use ZFS for the hdd and installed mate for my desktop environment. I've noticed that at times the machine will be using over 90 percent of the ram ... typically after I've mounted and external hard drive and transferred data to the internal hdd. I've tried running top from the command line but haven't seen anything jump out as being the culprit. Any pointers would be appreciated.
 
OP
coyote_zed

coyote_zed

Member

Reaction score: 2
Messages: 58

Nothing to worry about. ZFS heavily makes use of RAM available. There are quite some threads here in the forums about that topic.
So if I want to keep the ram usage down is it safe to assume I should switch to using ufs?
 
OP
coyote_zed

coyote_zed

Member

Reaction score: 2
Messages: 58

You should better accept what ZFS does and use the forum search function above.
Unused RAM is wasted RAM in this case. Or do you face any problems besides watching the RAM usage?
I'm just wanting to learn how to optimize the usage of ram. I tried using the search bar but had difficulty finding the answer I am looking for. I like the features that ZFS offers and would like to learn more about it. I'm just curious if the spike in ram usage is due to the transferring data (sometimes up to 50 Gb) from the external drive and then will lower after ZFS is done processing. It seems like the ram is being used for quite a while after the data is transferred and I'm trying to find out why. Maybe I'm just not searching the correct terms.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,025
Messages: 38,480

So if I want to keep the ram usage down is it safe to assume I should switch to using ufs?
It's going to use just as much memory. There's an age old mantra that says, unused memory is useless memory. Most of this "used" memory are various caches, regardless if it's ZFS or UFS. These will be purged if there are more pressing memory needs somewhere else.

I'm just wanting to learn how to optimize the usage of ram.
The best thing to do is to stop worrying about it and let the system do what it's designed to do. One of the core components of any kernel (not just FreeBSD's) is to manage memory.

The only time you should worry about memory is when the system starts swapping excessively.
 

Oko

Daemon

Reaction score: 794
Messages: 1,620

I'm just wanting to learn how to optimize the usage of ram. I tried using the search bar but had difficulty finding the answer I am looking for. I like the features that ZFS offers and would like to learn more about it. I'm just curious if the spike in ram usage is due to the transferring data (sometimes up to 50 Gb) from the external drive and then will lower after ZFS is done processing. It seems like the ram is being used for quite a while after the data is transferred and I'm trying to find out why. Maybe I'm just not searching the correct terms.

It is normal for ZFS. At work, I have an older server with 24 GB or RAM with two ZFS pools (one 1T mirror, and 4 TB RAIDZ2). RAM is always 95% in use. Even for a small file server you need at least 32GB of RAM. I don't recommend ZFS on the laptop (but I also don't run FreeBSD on my laptops either).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,025
Messages: 38,480

My home server runs all sorts of things on just 8GB, 11TB ZFS pool, various services, even 2 or 3 bhyve guests. And there's very little swapping. Obviously I do get some swap usage, especially with 2 or more small VMs running. But everything just keeps chugging along. On the other hand, servers at work have an excess of memory, typically 256GB and more. Even those have a few MB swapped out and around 90% usage.
 
OP
coyote_zed

coyote_zed

Member

Reaction score: 2
Messages: 58

SirDice - Thanks for the explanation about the caches, that helps a lot.
Oko - Thanks for the info.

Putting the info into context helped a lot too. Thanks again!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,025
Messages: 38,480

What's their mission?
Running a bunch of websites. They're a tad "overpowered" though. But, the plus side is that almost everything runs from RAM eventually. The database servers typically have something in the order of 368GB.
 

ralphbsz

Son of Beastie

Reaction score: 2,301
Messages: 3,211

I've never seen a server with that amount of RAM. What's their mission?
At work, there are quite a few machines with 1/2 TB, and the first 1TB machines are showing up. There are also machines with many hundreds of disk drives connected. And machines where every single PCIe slot is filled with SAS-3 and InfiniBand cards. These machines have high core count CPUs too. Their purpose is typically IO servers and data management for cluster computing.

RAM is good. It allows caching, and memory is much faster than disk. It can also be necessary; certain data structures really can only be kept in memory. In contrast, at home I have a FreeBSD machine that has 1gig of RAM, and its only disk drive is an 8G SD card (a Raspberry Pi).
 
Top