From owner-freebsd-questions@FreeBSD.ORG Tue Dec 13 18:17:49 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B55A41065675 for ; Tue, 13 Dec 2011 18:17:49 +0000 (UTC) (envelope-from kryukdmitriy@rambler.ru) Received: from mxb.rambler.ru (mxb.rambler.ru [81.19.66.14]) by mx1.freebsd.org (Postfix) with ESMTP id 727F58FC13 for ; Tue, 13 Dec 2011 18:17:49 +0000 (UTC) Received: from maild.rambler.ru (maild.rambler.ru [81.19.66.33]) by mxb.rambler.ru (Postfix) with ESMTP id 4FD6610284 for ; Tue, 13 Dec 2011 21:59:58 +0400 (MSK) Received: from [192.168.0.3] (unknown [178.74.103.228]) (Authenticated sender: kryukdmitriy@rambler.ru) by maild.rambler.ru (Postfix) with ESMTP id B588F84497 for ; Tue, 13 Dec 2011 21:59:55 +0400 (MSK) Message-ID: <4EE79220.8050007@rambler.ru> Date: Wed, 14 Dec 2011 00:57:52 +0700 From: Dmitriy Kryuk User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111004 Icedove/3.0.11 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Free memory exhausted by networking X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2011 18:17:49 -0000 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?