Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 2000 10:51:45 +0400 (MSD)
From:      "Cyril A. Vechera" <cyril@main.piter.net>
To:        ak@freenet.co.uk, dick@seaman.org
Cc:        freebsd-hackers@FreeBSD.ORG, jasone@canonware.com
Subject:   Re: Multithreaded server performance
Message-ID:  <200004250651.KAA10775@main.piter.net>

next in thread | raw e-mail | index | archive | help
> From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 25 06:02:09 2000
> Date: Tue, 25 Apr 2000 05:23:39 +0300
> From: A G F Keahan <ak@freenet.co.uk>
> To: "Richard Seaman, Jr." <dick@seaman.org>
> Cc: Jason Evans <jasone@canonware.com>, freebsd-hackers@FreeBSD.ORG
> Subject: Re: Multithreaded server performance
>
> Jason and Richard,
>
> 		thank you very much for your explanations of libc_r and
> LinuxThreads.   Due to the significant processing time of each request
> (typically between 50-800ms, averaging 100ms), I doubt that FreeBSD's
> threads would perform any worse than if I forked a separate process for
> each connection (memory usage would go sky high), or even if I had a
> single process and called poll() myself to check each descriptor for
> being readable/writable.   What worries me though is that by design
> client connections are kept alive (although the server is allowed to
> disconnect a client after a period of inactivity), hence after a while
> there will be a lot of idle descriptors, and continuously polling them
> might slow down the processing of the active ones.   I have to

There is a way to save from slowing down on lot of connections.
If we assume that response time is not consired to be too fast,
for example, 500-5000 msec, we can poll() not all sockets, but just
delay inserting some sockets in polling set.

Look how it works:
1. we've made socket action (accept, read etc)
2. insert socket into poll/select waiting set after N msec
3. if socket has any activity within M msec, go to 1.
4. delay socket insertion on L msec

If some of connections require most interactivity, they
must use its own L,M,N. Only overhead we have is supporting
two queues of active and frozen sockets.

So, by variation L,M,N we have array of only 32 descriptors for poll()
and really work with about 1000 sockets, working in single process
without treads and forks.


Sincerely your,
	Cyril A. Vechera


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?200004250651.KAA10775>