chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Re: Very slow keep-alive behaviour on Spiffy


From: Graham Fawcett
Subject: Re: [Chicken-users] Re: Very slow keep-alive behaviour on Spiffy
Date: Sat, 20 May 2006 10:52:40 -0400

On 5/19/06, Daishi Kato <address@hidden> wrote:
Hi,

I too have noticed this problem while I was modifying
http-client.scm. ngrep (or tcpdump) shows
several packets for even a small http request/response.
This could have been solved by buffering in http-client,
but the better solution I imagined was also to buffer
at tcp port level, which I'm not sure how to code it.

Yes, I could see how input buffering would be useful as well.

Attached is the output-buffer definition I came up with -- could
probably use some improvements, but it does seem to solve the
small-message-related problems I've been seeing here. Thanks to Thomas
for the fast substring-set! implementation.

Defining a macro:

(define-macro (with-buffered-output bufsize . body)
 `(with-output-to-port
      (output-buffer (current-output-port) ,bufsize)
    (lambda ()
      ,@body
      (flush-output))))

-- where 'body' would include the loop for persistent connections --
makes it pretty simple to adapt existing code. A buffer-size of 1500
would match the MTU on most systems, and still seems to work well on a
loopback connection.

Graham

Attachment: output-buffer.scm
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]