Free memory exhausted by networking

Dmitriy Kryuk kryukdmitriy at rambler.ru
Tue Dec 13 18:17:49 UTC 2011


I'm running Transmission (http://www.transmissionbt.com/), а BitTorrent 
client on my FreeBSD 7.2 box. It requests large recieve buffers for its 
network connections. This leaves my system with absolutely no free 
memory. If some process frees a large amount of memory, it gets consumed 
about 1.5 megabytes per second until it drops to zero.
I don't seem to have any problems like denied network connections or 
memory allocation, but it makes my system swap in and out often.
As top shows:

CPU: 24.9% user, 0.0% nice, 27.2% system, 33.1% interrupt, 14.8% idle
Mem: 217M Active, 143M Inact, 105M Wired, 25M Cache, 59M Buf, 8K Free
Swap: 4352M Total, 236K Used, 4352M Free

I wasn't able to reproduce this problem with any other program, but it 
clearly disappears when I stop Transmission. The amount of free memory 
rarely drops below 5 MB without Transmission running.
netstat -m shows nothing criminal:

4642/983/5625 mbufs in use (current/cache/total)
3380/214/3594/65536 mbuf clusters in use (current/cache/total/max)
3380/103 mbuf+clusters out of packet secondary zone in use (current/cache)
346/93/439/8480 4k (page size) jumbo clusters in use 
(current/cache/total/max)
0/0/0/4240 9k jumbo clusters in use (current/cache/total/max)
0/0/0/2120 16k jumbo clusters in use (current/cache/total/max)
9304K/1045K/10350K bytes allocated to network (current/cache/total)
0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters)
0/0/0 requests for jumbo clusters denied (4k/9k/16k)
0/5/4496 sfbufs in use (current/peak/max)
0 requests for sfbufs denied
0 requests for sfbufs delayed
0 requests for I/O initiated by sendfile
0 calls to protocol drain routines

My sysctl tunes:

vfs.usermount=1
kern.ipc.nmbclusters=65536
kern.ipc.maxsockbuf=4194304
kern.ipc.maxsockets=204800
net.tcp.sendbuf_inc=16384
net.inet.tcp.recvbuf_inc=131072
net.inet.ip.fastforwarding=1
net.inet.tcp.tcbhashsize="4096"

How do I make FreeBSD keep some memory free (and so avoid swapping) with 
Transmission running?


More information about the freebsd-questions mailing list