From owner-freebsd-hackers Mon Jul 10 3:37: 8 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from ywing.creative.net.au (ywing.creative.net.au [203.56.168.34]) by hub.freebsd.org (Postfix) with ESMTP id C9E2C37B5FF; Mon, 10 Jul 2000 03:37:01 -0700 (PDT) (envelope-from adrian@ywing.creative.net.au) Received: (from adrian@localhost) by ywing.creative.net.au (8.9.3/8.9.3) id MAA03342; Mon, 10 Jul 2000 12:43:55 +0200 (CEST) (envelope-from adrian) Date: Mon, 10 Jul 2000 12:43:55 +0200 From: Adrian Chadd To: Paul Herman Cc: Adrian Chadd , core-ix@hushmail.com, freebsd-hackers@FreeBSD.ORG Subject: Re: fork throttling (was Re: Some proposals to FreeBSD kernel) Message-ID: <20000710124355.D837@ywing.creative.net.au> References: <20000710111340.C837@ywing.creative.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: ; from pherman@frenchfries.net on Mon, Jul 10, 2000 at 11:47:24AM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Jul 10, 2000, Paul Herman wrote: > > On Mon, 10 Jul 2000, Adrian Chadd wrote: > > > On Mon, Jul 10, 2000, Paul Herman wrote: > > > Perhaps a discussion of something like FORK_RATELIMIT along the lines > > > of ICMP_BANDLIM is in order? > > > > why would you do that? If something wants to fork, let it fork. When > > it hits the upper limit defined your resource limitations, it returns > > an error. Having it slow down before erroring out and then providing > > the tweaks to make this controllable sounds to me like too much added > > complexity for no real gain. > > It's just like in my DSP programing days with limiting vs. clipping. > The best solution which is most pleasing to the ears is a combination > of both. (speaking of "gain" :) > > I envision highly loaded webservers/mailservers/etc (according to > login class) slightly (usecs) slowing forking down to let other procs > finish up IO or whatever it needs to do, before forking. To me, this > seems much more elegant and desireable than just burping up fork > errors "500 Internal Server Error", or "503 Server Unavailable". > > Like you say, it is probably too much added complexity, but it is > being optionaly implimented as we speak in some common servers, like > apache. One could quite validly argue that its a design fault with apache more than it is a problem the kernel could "solve". If the kernel wasn't scheduling correctly then I'd say "Its a kernel problem", but if the process is abusing forks or accept queues then I would be quite happy to say "its a userland problem". > If this behaviour is desired (and I know companies that do), it may > just be a simple philosophical question of whose job it would be to > throttle forks: userland or kernel. > > You may be right. It may be the domain of userland, but I can see > advantages of the generalities of it being in the kernel. Comments? Well, IMHO I think something like this implemented in the kernel for the reasons given above would let people write bad code. Should the kernel need massaging because people write bad code? The kernel is there to provide and schedule services for userland processes. Now, granted, there are a few things going into -current as of late which could also be attacked as letting people "write bad code", but those changes have been thoroughly discussed by many people and people are generally (hah!) agreed that they augment userland services more than replace them. > > Remember, resource limits are your friend. ;-) > > They are indeed. Don't get me wrong, I think the idea of introducing a sleep before each fork could be useful for resource limitations, but I also think that this can be implemented as an application sees fit. Otherwise, you'd have to make it a per-process tunable and add extra complexity for everything when only a few things would actually benefit from its use. Adrian -- Adrian Chadd Build a man a fire, and he's warm for the rest of the evening. Set a man on fire and he's warm for the rest of his life. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message