Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jul 2001 18:09:26 +0100
From:      Mark Blackman <mark@blackmans.org>
To:        "Albert D. Cahalan" <acahalan@cs.uml.edu>
Cc:        freebsd-stable@freebsd.org, jfortin@akalink.com
Subject:   Re: Regarding New FreeBSD BenchMark From Sysadmin Mag (left out a fiew tuning options)
Message-ID:  <20010715180926.A480@maddog.tele2.co.uk>
In-Reply-To: <200107130205.f6D250Y136048@saturn.cs.uml.edu>; from acahalan@cs.uml.edu on Thu, Jul 12, 2001 at 10:05:00PM -0400
References:  <200107130205.f6D250Y136048@saturn.cs.uml.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

I made a trivial change (scalar to array) to the tutorial code in
/usr/share/doc/psd/20.ipctut/dgramread.c and got 16384 bound
TCP (STREAM) sockets on a laptop with 128 megs of memory. I'm convinced
he wasn't trying very hard. I suspect Linux lets you do things
you shouldn't be able to without proper preparation of the
rest of the system.

I changed five tunables on a stock 4.3 system.

kern.ipc.maxsockets=20000	(in loader.conf, requires reboot)
kern.ipc.nmbclusters=20000	(in loader.conf, requires reboot)
kern.maxfiles=32768		(at runtime)
kern.maxfilesperproc=32768	(at runtime)
net.inet.ip.portrange.last=49151(at runtime)

That I was able to achieve this in 35 minutes as a pretty rusty C
coder where the combined efforts of Lyris struggled tells me they
weren't trying very hard. Obviously, this toy code isn't the
same as the Lyris software but it makes the point that it isn't
hard to get an arbitrary number of bound sockets.

Note that an alternative interpretation of the test is that 
FreeBSD was exposing a bug in the Lyris code that the other OSes
weren't and that the Lyris software doesn't check for error
codes in all cases.

Finally and most importantly, Lyris haven't volunteered to make the
code available so that we can investigate where the failing is. There
certainly isn't any fundamental architectural reason that FreeBSD
can't deliver that kind of performance.

- Mark

/* trivial code to bind 16384 sockets (TCP) */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>

/*
 * In the included file <netinet/in.h> a sockaddr_in is defined as follows:
 * struct sockaddr_in {
 *	short	sin_family;
 *	u_short	sin_port;
 *	struct in_addr sin_addr;
 *	char	sin_zero[8];
 * };
 *
 */
const int maxsock=16384;

main()
{
	int sock[maxsock], length,i;
	struct sockaddr_in name[maxsock];
	char buf[1024];

	for (i=0; i<maxsock; i++){
	/* Create socket from which to read. */
	sock[i] = socket(AF_INET, SOCK_STREAM , 0);
	if (sock[i] < 0) {
		perror("opening datagram socket");
		exit(1);
	}
	/* Create name with wildcards. */
	name[i].sin_family = AF_INET;
	name[i].sin_addr.s_addr = INADDR_ANY;
	name[i].sin_port = 0;
	printf("binding %d\n",i);
	if (bind(sock[i], &name[i], sizeof(name[0]))) {
		perror("binding datagram socket");
		sleep(10);
		exit(1);
	}
	/* Find assigned port value and print it out. */
	length = sizeof(name[i]);
	if (getsockname(sock[i], &(name[i]), &length)) {
		perror("getting socket name");
		exit(1);
	}
	printf("Socket has port #%d\n", ntohs(name[i].sin_port));

	}

    sleep(10);
	
	for (i=0; i<maxsock; i++){
	  close(sock[i]);
	}
}




On Thu, Jul 12, 2001 at 10:05:00PM -0400, Albert D. Cahalan wrote:
> 
> Jonathan Fortin writes:
> 
> > It is regarding the new benchmark (FreeBSD-tuned),
> >
> > They forgot to enable write-cache behind (enabled by default in windows2000
> > and linux) and a bit other options I would liked of seened.
> >
> > hw.ata.wc = 1
> 
> That is for ATA. They used SCSI.
> 
> Even if they had used ATA, AFAIK all the OSes in question leave
> the write cache as set by the manufacturer. This is different
> from explicitly enabling it. There was a FreeBSD version that
> explicitly disabled the write cache, but this was changed due
> to complaints about performance.
> 
> > net.inet.tcp.keepidle=10000
> > net.inet.tcp.keepintvl=10000
> > vm.pageout_algorithm=1
> > 
> > as for mount options,  "noatime".
> 
> It's bad enough that a tuned FreeBSD box still collapses under load,
> while the untuned Linux box doesn't. Now you want to make the FreeBSD
> box do less work. That looks like really foul play to me. The other
> systems have "noatime" available too you know.
> 
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-stable" in the body of the message
> 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010715180926.A480>