# FreeBSD 8.0 - amd64 - ZFS



## solskogen (Jan 9, 2010)

While running rtorrent (with 10 torrents) i got this: "pid 2793 (rtorrent), uid 1002, was killed: out of swap space"

The machine have only 2GB of memory and no zfs tuning. Since ZFS uses a lot of memory I guess that some kind of tuning is necessary despite the fact that it is FreeBSD 8.0 amd64 (zpool v 13, and zfs version 3) - any hints?

The system have no swap space because root is on a cf-card.


----------



## phoenix (Jan 9, 2010)

Does rtorrent have an option to not pre-allocate space for downloaded torrents?  From what I've been reading about ZFS and rtorrent, it seems like it may be the pre-allocation, and then writing to random offsets in the file that leads to a lot of issues for people.  That workload just doesn't suit ZFS' CoW semantics.

I use KTorrent on 32-bit FreeBSD with only 2 GB of RAM without issues or slowdowns, but I have it configured to not pre-allocate files.

With only 2 GB, you may need to tune the ARC size.  The amd64 version of FreeBSD 8.x supports a very large kmem, and can auto-tune ZFS pretty well.  But it really only seems to auto-tune perfectly when there's more than 4 GB of RAM (anecdotal).  You may want to try limiting the arc_max to 1 GB.

And, if you don't mind running -STABLE, quite a few updates and fixes for ZFS have gone into 8-STABLE, particularly around ARC sizing and maintenance.


----------



## solskogen (Jan 10, 2010)

Thanks, I'll look into it.

(a workaround that i figured out worked was to have swap on zfs - i did not think that would work but it did)


----------



## trasz@ (Feb 6, 2010)

"Out of swap space" means the application is running low on memory - application, not the filesystem.  So, this problem is not really related to ZFS.

In the rtorrent configuration file, there is a "max_memory_usage" parameter.  AFAIK it should make rtorrent limit the amount of memory it uses, which is what you need here.


----------

