guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-13-123-ge


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-13-123-ge6ae317
Date: Fri, 03 Dec 2010 15:27:29 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e6ae317306bb88528c1856ef8f39443376551c24

The branch, master has been updated
       via  e6ae317306bb88528c1856ef8f39443376551c24 (commit)
       via  0baead3f6e3fd99c8886208578d93be0794da0e8 (commit)
      from  462a1a04cf256a9f995721b5d210d7438b3fc89b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e6ae317306bb88528c1856ef8f39443376551c24
Author: Andy Wingo <address@hidden>
Date:   Fri Dec 3 16:30:52 2010 +0100

    web server micro-tuning
    
    * module/web/server/http.scm (http-open): Allow up to 128 pending
      connections -- the default value for somaxconn on a number of
      machines. This is from the HOP paper.
      (http-read): Set the send buffer to 12 KB, also from the HOP paper.

commit 0baead3f6e3fd99c8886208578d93be0794da0e8
Author: Andy Wingo <address@hidden>
Date:   Fri Dec 3 16:11:37 2010 +0100

    reverse order of poll-set traversal in http-read
    
    * module/web/server/http.scm (http-read): Rewrite to iterate down the
      pollset, so the vector shuffles touch less memory and the end
      condition of the loop is clearer.

-----------------------------------------------------------------------

Summary of changes:
 module/web/server/http.scm |  106 ++++++++++++++++++++++----------------------
 1 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/module/web/server/http.scm b/module/web/server/http.scm
index 1628e1d..7d63a70 100644
--- a/module/web/server/http.scm
+++ b/module/web/server/http.scm
@@ -56,70 +56,70 @@
                               INADDR_LOOPBACK))
                     (port 8080)
                     (socket (make-default-socket family addr port)))
-  (listen socket 5)
+  (listen socket 128)
   (sigaction SIGPIPE SIG_IGN)
   (let ((poll-set (make-empty-poll-set)))
     (poll-set-add! poll-set socket *events*)
-    (make-http-server socket 1 poll-set)))
+    (make-http-server socket 0 poll-set)))
 
 ;; -> (client request body | #f #f #f)
 (define (http-read server)
   (let* ((poll-set (http-poll-set server)))
     (let lp ((idx (http-poll-idx server)))
-      (cond
-       ((not (< idx (poll-set-nfds poll-set)))
-        (poll poll-set)
-        (lp 0))
-       (else
-        (let ((revents (poll-set-revents poll-set idx)))
+      (let ((revents (poll-set-revents poll-set idx)))
+        (cond
+         ((zero? idx)
+          ;; The server socket, and the end of our downward loop.
           (cond
            ((zero? revents)
-            ;; Nothing on this port.
-            (lp (1+ idx)))
-           ((zero? idx)
-            ;; The server socket.
-            (if (not (zero? (logand revents *error-events*)))
-                ;; An error.
-                (throw 'interrupt)
-                ;; Otherwise, we have a new client. Add to set, then
-                ;; find another client that is ready to read.
-                ;;
-                ;; FIXME: preserve meta-info.
-                (let ((client (accept (poll-set-port poll-set idx))))
-                  ;; Set line buffering while reading the request.
-                  (setvbuf (car client) _IOLBF)
-                  (poll-set-add! poll-set (car client) *events*)
-                  (lp (1+ idx)))))
-           ;; Otherwise, a client socket with some activity on
-           ;; it. Remove it from the poll set.
+            ;; No client ready, and no error; poll and loop.
+            (poll poll-set)
+            (lp (1- (poll-set-nfds poll-set))))
+           ((not (zero? (logand revents *error-events*)))
+            ;; An error.
+            (throw 'interrupt))
            (else
-            (let ((port (poll-set-remove! poll-set idx)))
-              (cond
-               ((or (not (zero? (logand revents *error-events*)))
-                    (eof-object? (peek-char port)))
-                ;; The socket was shut down or had an error. See
-                ;; http://www.greenend.org.uk/rjk/2001/06/poll.html
-                ;; for an interesting discussion.
-                (close-port port)
-                (lp idx))
-               (else
-                ;; Otherwise, try to read a request from this port.
-                ;; Next time we start with this index.
-                (set-http-poll-idx! server idx)
-                (call-with-error-handling
-                 (lambda ()
-                   (let ((req (read-request port)))
-                     ;; Block buffering for reading body and writing response.
-                     (setvbuf port _IOFBF)
-                     (values port
-                             req
-                             (read-request-body/latin-1 req))))
-                 #:pass-keys '(quit interrupt)
-                 #:on-error (if (batch-mode?) 'pass 'debug)
-                 #:post-error
-                 (lambda (k . args)
-                   (warn "Error while reading request" k args)
-                   (values #f #f #f))))))))))))))
+            ;; A new client. Add to set, poll, and loop.
+            ;;
+            ;; FIXME: preserve meta-info.
+            (let ((client (accept (poll-set-port poll-set idx))))
+              ;; Set line buffering while reading the request.
+              (setvbuf (car client) _IOLBF)
+              ;; From "HOP, A Fast Server for the Diffuse Web", Serrano.
+              (setsockopt (car client) SOL_SOCKET SO_SNDBUF (* 12 1024))
+              (poll-set-add! poll-set (car client) *events*)
+              (poll poll-set)
+              (lp (1- (poll-set-nfds poll-set)))))))
+         ((zero? revents)
+          ;; Nothing on this port.
+          (lp (1- idx)))
+         ;; Otherwise, a client socket with some activity on
+         ;; it. Remove it from the poll set.
+         (else
+          (let ((port (poll-set-remove! poll-set idx)))
+            (cond
+             ((eof-object? (peek-char port))
+              ;; EOF.
+              (close-port port)
+              (lp (1- idx)))
+             (else
+              ;; Otherwise, try to read a request from this port.
+              ;; Record the next index.
+              (set-http-poll-idx! server (1- idx))
+              (call-with-error-handling
+               (lambda ()
+                 (let ((req (read-request port)))
+                   ;; Block buffering for reading body and writing response.
+                   (setvbuf port _IOFBF)
+                   (values port
+                           req
+                           (read-request-body/latin-1 req))))
+               #:pass-keys '(quit interrupt)
+               #:on-error (if (batch-mode?) 'pass 'debug)
+               #:post-error
+               (lambda (k . args)
+                 (warn "Error while reading request" k args)
+                 (values #f #f #f))))))))))))
 
 (define (keep-alive? response)
   (let ((v (response-version response)))


hooks/post-receive
-- 
GNU Guile



reply via email to

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