# [REQUEST] Can somebody provide a simple How-To on optimizing memory usage on a ZFS install for a desktop machine?



## i-bsd (May 22, 2018)

I have a high-end machine with 16 gigs of ram. AutoZFS installed.

I limited ARC to 10gig because my desktop system was running out of memory and swap, and then freezing. It's STILL doing it.

Need an optimization guide for desktops (especially modern machines with high specs). FreeBSD is definitely not optimized out-of-the-box for high spec desktops.

Thanks.


----------



## tankist02 (May 23, 2018)

I found that some buggy programs can consume all memory. After that OS will gradually get slower and then freeze. So now I start such programs with:


```
limits -v 1g <program>
```

and my problem is gone - the misbehaving program will be killed instead of freezing the whole system. This is on FreeBSD 11.2 Prerelease 16GB RAM from which 8GB is reserved for ZFS ARC. BTW at first I allocated 10G for the ARC, but it lead to excessive swapping.


----------



## ShelLuser (May 23, 2018)

i-bsd said:


> I have a high-end machine with 16 gigs of ram. AutoZFS installed.


What is AutoZFS? Or did you mean to say that you used the installer to set up ZFS for you?

With issues like these it's very important to be as precise and to the point as possible so that there can be no confusion about anything. See; for all I know you could have installed some weird software which is now messing things up.



i-bsd said:


> I limited ARC to 10gig because my desktop system was running out of memory and swap, and then freezing. It's STILL doing it.


ARC?  Also: how did you limit it?

(edit) Went over your profile and checked out another thread of yours. You meant to say that you set 
vfs.zfs.arc_max. Why assume though that it was ZFS causing your issues? I would definitely recommend against messing with ZFS tunable settings, especially because I find it hard to believe that this caused by ZFS. It is memory hungry, sure, but it does _not_ gobble up all memory in the likes as you've been describing.

Also: you're not really giving us enough information to even start analyzing what could be going on. For example... How is your swap set up? How is your ZFS pool set up? Other than limiting vfs.zfs.arc_max; what else did you change?



i-bsd said:


> FreeBSD is definitely not optimized out-of-the-box for high spec desktops.


Yet it is.

And speaking of desktops: what software do you use for that? Because by default FreeBSD is not a desktop OS, that's all handled by 3rd party software starting with X. Which means that there is plenty of extra's going on where things could have been mis-configured or failing otherwise. And that's hardly something you can blame FreeBSD for.

(edit)

Also very important: what version of FreeBSD are you using anyway?

(last edit)

I looked this up and it seems that the installer provides you with 2Gb worth of swap by default, as far as I can tell this is a static value. So is it possible that you set up 2Gb worth of swap on that setup? Try using `gpart show` to find out.

That could definitely explain a thing or two....


----------



## Oko (May 23, 2018)

i-bsd said:


> I have a high-end machine with 16 gigs of ram.


You are not serious  This is what we call in U.S. of A an average desktop machine


```
root@lov1$ free -h
              total        used        free      shared  buff/cache   available
Mem:           754G        411G        190G        324M        151G        338G
Swap:          4.0G         52M        3.9G
```


----------



## Π 5C15 (May 23, 2018)

i-bsd said:


> Need an optimization guide for desktops (especially modern machines with high specs). FreeBSD is definitely not optimized out-of-the-box for high spec desktops.
> 
> Thanks.



Sorry man, but this isn't a delivery: you should ask for help and give the pertinent information. You're in no position to tell if FBSD is or not "out of the box", nor for ask for a guide like we were butlers or technicians at your orders. You must give us information (thing that I believe that someone that it's capable of doing such things as edit ARC can obtain easily), then based on it, we can try to help you. But we're not here for you: this is a forum, we are persons that have a life out of here, you should wait for an answer. Neither we have a crystal ball to guess what you've done to your system.
First that, now:
One thing it's that you didn't optimized *your personal system* and other thing it's say that FreeBSD it's not optimized at a *general level*. I have 4GB and sometimes I'm out of memory, but that it's a thing about my hardware, not _because the system is not optimized_ for whatever.
First, you should went to here with a different attitude, obtain information, and give us what you know. Not ask for a guide like we're at your orders, say that the system is not optimized (here you *should* take a look: https://www.freebsd.org/doc/faq/hardware.html) when you are the responsible for maintain for personal system, and finally, don't touch things such as delimitation of ARC when you have no idea of how configure a swap to use all your RAM.
The second it's what others users said: check if your configuration of whatever you've done to your system is not the problem. As I said, I don't have a crystal ball to see which are your configurations, neither I'm a detective nor hacker to find that information. So, you should get it and post it.


----------



## Π 5C15 (May 23, 2018)

Despite your attitude, the poor information that you gave us, and the bs that you said about something that you have no idea, I'll try to help you...
Right now, I'm in another OS. And because I don't have VM of FBSD in my actual system, I can't test the commands that I will give you. But you should take a look at the handbook and the forums.
Use this: https://www.freshports.org/sysutils/memtest86
This: 
	
	



```
pkg install atop
```
This: 
	
	



```
pkg install htop
```
Do: 
	
	



```
top
```
Then, if you aren't capable to read the output or you want some more information that the provided in the latest command, use atop and htop to see which processes are consuming your RAM (or if they aren't using it) and how much they're using.
Try with that and what we told you. And remember: don't be prepotent and give information, then wait for a help.


----------

