[plt-scheme] Limiting Concurrent Connections to Web Server

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jan 16 10:33:29 EST 2009

On Fri, Jan 16, 2009 at 9:30 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> On Fri, Jan 16, 2009 at 9:17 AM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>> On Fri, Jan 16, 2009 at 8:02 AM, Henk Boom <lunarc.lists at gmail.com> wrote:
>>> 2009/1/16 Robby Findler <robby at eecs.northwestern.edu>:
>>>> Perhaps I misunderstood, but I think Henk was looking for a different
>>>> behavior, ie when there are too many connections in session that the
>>>> webserver would just close and forget about the other connections.
>>
>> I'm not sure how to do this... with semaphores I could use
>> semaphore-try-wait?, but I don't know how to recreate that with the
>> manager.
>
> Oh, I was thinking of something where you'd hold onto a few
> connections (like you're doing), but after some limit there, the
> manager thread would just respond immediately with "close the
> connection" and the thread that got the connection wouldn't block, but
> would instead just shutdown the ports and die. Something like that.

Actually, it may be better to hold onto the newer connections and
start dropping older ones. So you'd have a buffer of some N pending
connections and when the pending connection limit is exceeded, you'd
start dropping older pending connections in favor of newer pending
connections.

(This is one of the great things about CML that we inherit -- you can
design whatever useful protocol you want and they are easy to get
right.)

Robby


Posted on the users mailing list.