Date: Thu, 16 Nov 2000 12:19:41 +0100 From: "Nicolai Petri" <nicolai@petri.cc> To: <andrew@ugh.net.au> Cc: <freebsd-hackers@freebsd.org> Subject: Re: Multithreaded tcp-server or non-blocking ? Message-ID: <023301c04fbf$1f9c2ad0$6732a8c0@atomic.dk> References: <Pine.BSF.4.21.0011162051330.10324-100000@starbug.ugh.net.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> From: <andrew@ugh.net.au> > 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 . > That is probably simplest from a programming point of view. That's sounds fine to me.. :o) > > Or to make a > > non-blocking single thread server. > That will probably give you the best performance. It willl probably use > slightly less RAM as well but not enough to be of an issue unless you are > trying to fit in 4MB or something. I've got plenty of RAM. It's more a question of stability / simplicity. > > Can people show me some simple examples > > of the 2 techniques ? > As in web servers that use one or the other method or are you just after > software that uses pthreads and/or non blocking I/O? > For non blocking I/O you are probably after select, poll or kqueue. I'm quite lost here.. Is there a good reason for using kqueue instead of select/poll ? > I have a basic program that uses pthreads if that will help...it uses > kqueue as well although not for non blocking I/O. Its not finished but the > threading part works... I would love to see the code.. I'm having some stability problems with my own code. Maybe I can figure out where I went wrong. > > And what's the pro's and con's for the 2 methods ??? > > It really does depend on what you're trying to acheive...I'd tend to go > for the threads solution with the argument that the programmers time is > worth far more than the extra hardware it would take to make up any minor > performance penalty. I personally prefer the most simple and failsafe solution. Too much performance hunting will often give less understandable/debugable code. --- Thanks for your good answers. - Nicolai Petri To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?023301c04fbf$1f9c2ad0$6732a8c0>