Heavy use (rtorrent) UFS issues

i'm have issues with UFS filesystem... I use rtorrent with heavy load (about 100-200GB LAN transfer) and i have huge pool of Active memory staying till i remount affected filesystem, after it memory gets freed. Its not freed after i quit rtorrent it stays active here. Look after umount affected filesystem on which torrent files are (/nas/STM3750330AS) memory was freed..

FreeBSD 8.1-PRERELEASE (25 May 2010) i think rev. 208543

Code:
Mem: 2765M Active, 484M Inact, 538M Wired, 118M Cache, 418M Buf, 47M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse

umount -a -t nullfs
Mem: 2764M Active, 484M Inact, 538M Wired, 118M Cache, 418M Buf, 48M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse

vmstat
 procs      memory      page                    disks     faults         cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr ad0 ad1   in   sy   cs us sy id
 0 0 0   1776M   165M  2542  26  27  75  1679 3259   0   0 9119 79756 53125  3 10 88

Mem: 2765M Active, 484M Inact, 538M Wired, 118M Cache, 418M Buf, 47M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse

mount
/dev/ada0s2a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/ada0s2e on /usr (ufs, local, soft-updates)
/dev/ada0s2d on /var (ufs, local, soft-updates)
/dev/ada0s2f on /jail (ufs, local, noatime, soft-updates)
/dev/ada0s3d on /nas/STM3750330AS (ufs, local, read-only, soft-updates)
/dev/ada1s1d on /nas/ST31000528AS (ufs, local, read-only, soft-updates)
/dev/ada2s1d on /nas/ST31000340NS (ufs, local, read-only, soft-updates)
/dev/md0 on /tmp (ufs, asynchronous, local, noatime)

umount /nas/ST31000340NS
Mem: 2764M Active, 484M Inact, 537M Wired, 118M Cache, 418M Buf, 49M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse

umount /nas/ST31000528AS
Mem: 2765M Active, 484M Inact, 537M Wired, 118M Cache, 418M Buf, 47M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse
vmstat
 procs      memory      page                    disks     faults         cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr ad0 ad1   in   sy   cs us sy id
 0 0 0   1776M   166M  2533  26  27  75  1673 3247   0   0 9086 79465 52933  3 10 88

umount /nas/STM3750330AS (This is affected by rtorrent filesystem!!!)
Mem: 81M Active, 3984K Inact, 135M Wired, 528K Cache, 418M Buf, 3730M Free
Swap: 4096M Total, 202M Used, 3893M Free, 4% Inuse
vmstat
 procs      memory      page                    disks     faults         cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr ad0 ad1   in   sy   cs us sy id
 0 0 0   1776M  3731M  2529  26  27  75  1700 3242   0   0 9074 79357 52862  3 10 88
 
Disclaimer: memory management is not my field, so the explanation below might be wrong.

What you see is not a bug, it's a feature. Memory pages stay marked "active", because there is no need for the VM system to "deactivate" them - there is no memory pressure, so doing it would be a waste of CPU cycles. When you run something memory-hungry and memory pressure starts, _then_ the no longer used pages will get scanned by the VM system and reused for other purpose.
 
i had problems too with rtorrent - 1,5 from 2 gigs go like nothing in seconds on big files.
i switch to ctorrent.
 
rTorrent uses mmap on all the file pages, that causes VM to allocate all non active memory to feed those memory maps. As rTorrent does not use buffers but directly feeds those mapped pages from the net stack it does give it a significant speed boost but only when you have a big bunch of connections.
 
expl said:
rTorrent uses mmap on all the file pages, that causes VM to allocate all non active memory to feed those memory maps. As rTorrent does not use buffers but directly feeds those mapped pages from the net stack it does give it a significant speed boost but only when you have a big bunch of connections.

when i quit rtorrent it still hanging in active memory
 
trasz@ said:
Disclaimer: memory management is not my field, so the explanation below might be wrong.

What you see is not a bug, it's a feature. Memory pages stay marked "active", because there is no need for the VM system to "deactivate" them - there is no memory pressure, so doing it would be a waste of CPU cycles. When you run something memory-hungry and memory pressure starts, _then_ the no longer used pages will get scanned by the VM system and reused for other purpose.

indeed after i ran
Code:
perl -e '$x="x"x3000000000'
memory was reclaimed...

But few days before i got some coredump cause of low kernel memory when i not used swap
 
@kdulep: Are you sure that this coredump was related to the amount of "active" memory? It shouldn't be, imho.
 
trasz@ said:
@kdulep: Are you sure that this coredump was related to the amount of "active" memory? It shouldn't be, imho.

i'm not sure but with swap things get more smooth

it was like this
Code:
Mem: 50M Active, 16M Inact, 226M Wired, 3580K Cache, 418M Buf, 3655M Free
...
after some time, mem dump N/A
kernel: pid 40367 (rtorrent), uid 0, was killed: out of swap space
= After crash =

Rtorrent starts hashing
Mem: 2885M Active, 98M Inact, 638M Wired, 210M Cache, 418M Buf, 120M Free

.rtorrent.rc
Code:
max_memory_usage=1024M
hash_read_ahead = 64
hash_interval = 10
hash_max_tries = 5

so im unable to run rtorrent without swap on 4GB system
 
Back
Top