From owner-freebsd-hackers Thu Nov 16 4:20:44 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from phobos.illtel.denver.co.us (dsl-206.169.4.82.wenet.com [206.169.4.82]) by hub.freebsd.org (Postfix) with ESMTP id 746A037B479 for ; Thu, 16 Nov 2000 04:20:42 -0800 (PST) Received: from localhost (abelits@localhost) by phobos.illtel.denver.co.us (8.9.3/8.9.3) with ESMTP id EAA16924; Thu, 16 Nov 2000 04:21:32 -0800 Date: Thu, 16 Nov 2000 04:21:32 -0800 (PST) From: Alex Belits To: Nicolai Petri Cc: freebsd-hackers@freebsd.org Subject: Re: Multithreaded tcp-server or non-blocking ? In-Reply-To: <021501c04fb9$574f9030$6732a8c0@atomic.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 16 Nov 2000, Nicolai Petri wrote: > What's the best approach for a simple web-server(never more the 10 clients) > ? Is it using pthread and a thread per connection . Or to make a > non-blocking single thread server. Can people show me some simple examples > of the 2 techniques ? > > And what's the pro's and con's for the 2 methods ??? I would prefer one process without nonblocking i/o, as multithreaded program easily becomes hard to manage if you have any more or less complex data model. However even apache-style multiple processes will work, and will be even simplier than either -- the disadvantage is only that it will have to keep all processes independent, so some kinds of processing will be hard to implement. I wrote my own HTTP server (fhttpd) that combines nonblocking main process and multiple backend modules processes that can be blocking or nonblocking -- it's possible that what you are trying to accomplish can be done in fhttpd module without writing a full-blown server. -- Alex ---------------------------------------------------------------------- Excellent.. now give users the option to cut your hair you hippie! -- Anonymous Coward To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message