From owner-freebsd-current@FreeBSD.ORG Wed Jan 4 22:34:24 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F27D21065672 for ; Wed, 4 Jan 2012 22:34:24 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8C3838FC14 for ; Wed, 4 Jan 2012 22:34:24 +0000 (UTC) Received: by wibhr1 with SMTP id hr1so17589154wib.13 for ; Wed, 04 Jan 2012 14:34:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zIxHpDBt2y854d9Vjd1pszZcRKAsHaLwETAmII3kiFk=; b=ESCXdRU/eVIrtuUKSKq/5QcMvg2KDV4qCEZQIknpsuxo5zzzzl3MkWT5kWB5d03mRP jRrOcMr1ndAyh0luuX6yuZXGBjEF34ei326ceQPMCBO5/mVreOj1ALP3MgHRum8jc85W cFI9DvT2UCIkrokJZ0yfsUl32HcECvHNN3x2I= MIME-Version: 1.0 Received: by 10.180.106.165 with SMTP id gv5mr125843273wib.18.1325716462707; Wed, 04 Jan 2012 14:34:22 -0800 (PST) Received: by 10.216.178.204 with HTTP; Wed, 4 Jan 2012 14:34:22 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Jan 2012 17:34:22 -0500 Message-ID: From: Arnaud Lacombe To: Dan The Man Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current@freebsd.org Subject: Re: sysctl kern.ipc.somaxconn limit 65535 why? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2012 22:34:25 -0000 Hi, On Wed, Jan 4, 2012 at 3:22 PM, Dan The Man wrote: > > > sunsaturn:~# sysctl -w kern.ipc.somaxconn=200000 > kern.ipc.somaxconn: 4096 > sysctl: kern.ipc.somaxconn: Invalid argument > sunsaturn:~# sysctl -w kern.ipc.somaxconn=65536 > kern.ipc.somaxconn: 4096 > sysctl: kern.ipc.somaxconn: Invalid argument > sunsaturn:~# sysctl -w kern.ipc.somaxconn=65535 > kern.ipc.somaxconn: 4096 -> 65535 > sunsaturn:~# > > Trying to stress test a framework here that tosses 100k of connections into > a listen queue before doing anything, I realize I'll have to use multiple > local IPs get get around port limitations, but why is this backlog using a > limit? > This is an arbitrary implementation limitation. A bit of code archaeology reveals that the explicit limitation was introduced in 1,226 of kern/uipc_socket.c[0]. Quoting the commit log: glebus@ << - Convert so_qlen, so_incqlen, so_qlimit fields of struct socket from short to unsigned short. - Add SYSCTL_PROC() around somaxconn, not accepting values < 1 or > U_SHRTMAX. Before this change setting somaxconn to smth above 32767 and calling listen(fd, -1) lead to a socket, which doesn't accept connections at all. Reviewed by: rwatson Reported by: Igor Sysoev >> so the limited width of some `struct socket' fields enforces this limitation. Now, the reason for `so_qlen', `so_incqlen', `so_qlimit' to be so limited might be lost in the arcane of time. After all "640K ought to be enough for anyone", doesn't it ? - Arnaud [0]: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/uipc_socket.c#rev1.226 > > Dan. > > > -- > Dan The Man > CTO/ Senior System Administrator > Websites, Domains and Everything else > http://www.SunSaturn.com > Email: Dan@SunSaturn.com > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"