Is it possible something similar to zRam in FreeBSD?

Good day!

I have some experience of using linux zram on a machine with low memory and it gives absolutely good results when memory is not enough and it starts swap. Is FreeBSD has something like zram and if not, is it may be developed or it is a denied by a core developers?
 
It would help if you'd be a bit more specific. We claim to know FreeBSD here but not necessarily Linux, and quite frankly I have no idea what zram is supposed to be. Alas, I found this:

https://en.wikipedia.org/wiki/Zram

FreeBSD can also do this (assuming I understand what you're after), but in a different way. It supports virtual memory and can also use files for swap. For regular usage (such as temporary files in /tmp) the tmpfs is often used (see tmpfs(5)).

Then memory disk support is provided through the md driver, see also mdconfig(8). This is most often used to gain access to images such as ISO files.

However, I'm not fully sure what you're after here. If this is about adding more swap space then you can also simply use dd to create an imagefile and then use swapon to initialize swap space on it. It works but I wouldn't recommend this.

Note that all this doesn't use any compressed images or such.

(edit): But when used on a compressed filesystem then I suppose you'll get somewhat of the same results. Though I wouldn't count on optimal performance though.

Hope this somewhat answers your question.
 
I think zram actually compress the data on ram, and keep it in there as long as possible before start swapping.

I may be confusing but I think I already seen something similar on DragonFly.
 
Best reply for the bad question :)

I think zram actually compress the data on ram, and keep it in there as long as possible before start swapping.
Yes and not. As I understand, when zram configured you set maximum amount data stored on zram device, for example 300MB.
And that amount of data stored with compression will eats from real memory less than allocated amount. Let's compress ratio will be 3x, so 300MB will eats 100MB, and there will be + 200MB virtually to RAM without swapping on a slow drive.
So there is a benefit in memory with cost of some CPU for compression\decompression.

When system has a very low RAM (as my old laptop with 256MB), that trick sufficiently improves desktop tasks.

However, I'm not fully sure what you're after here. If this is about adding more swap space then you can also simply use dd to create an imagefile and then use swapon to initialize swap space on it. It works but I wouldn't recommend this.
There is not only used as additional swap, mainly as fastest compressed swap and also it has ability to press non-compressed blocks to backed swap (hdd based swap)

Guys, sorry for my english, I know that it is very brain destructed :)
 
My laptop swaps on a compressed file, works great. Once the data is compressed in the ZFS write cache, memory pressure is a lot lower and it might newer been written out. So yes, we have something like that.
 
My laptop swaps on a compressed file, works great. Once the data is compressed in the ZFS write cache, memory pressure is a lot lower and it might newer been written out. So yes, we have something like that.
How You do that? If this is based on ZFS compression, so it is not solution for me, because my laptop has only 256MB RAM and I think that ZFS is not a option for it :)
 
because my laptop has only 256MB RAM and I think that ZFS is not a option for it
I tend to keep a minimum of 2GB before using ZFS. Anything less and it's probably going to be somewhat problematic, ZFS really likes RAM. And prefers to have lots of it.
 
Back
Top