From 0709c233359367751674866d69b40e881919eb48 Mon Sep 17 00:00:00 2001 From: Mike Silbersack Date: Fri, 24 Oct 2003 05:44:14 +0000 Subject: [PATCH] Reduce the number of tcp time_wait structs to maxsockets / 5; this ensures that at most 20% of sockets can be in time_wait at one time, ensuring that time_wait sockets do not starve real connections from inpcb structures. No implementation change is needed, jlemon already implemented a nice LRU-ish algorithm for tcp_tw structure recycling. This should reduce the need for sysadmins to lower the default msl on busy servers. --- sys/netinet/tcp_subr.c | 2 +- sys/netinet/tcp_timewait.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 613ea5999c77..d2a28c841db6 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -259,7 +259,7 @@ tcp_init() uma_zone_set_max(tcpcb_zone, maxsockets); tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcptw_zone, maxsockets); + uma_zone_set_max(tcptw_zone, maxsockets / 5); tcp_timer_init(); syncache_init(); } diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 613ea5999c77..d2a28c841db6 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -259,7 +259,7 @@ tcp_init() uma_zone_set_max(tcpcb_zone, maxsockets); tcptw_zone = uma_zcreate("tcptw", sizeof(struct tcptw), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcptw_zone, maxsockets); + uma_zone_set_max(tcptw_zone, maxsockets / 5); tcp_timer_init(); syncache_init(); }