Re: client_side.c speedup when sending body

From: Duane Wessels <wessels@dont-contact.us>
Date: Tue, 9 May 2000 21:23:24 -0600

On Tue, 9 May 2000, Adrian Chadd wrote:

>
> After reading the client side handling code (which scared me..) I

thanks.

> figured out that if we are JUST sending the body, we can bypass
> the complexity and just spray the body data out the client socket.
> This doesn't work for range request, headers, or header+body writes.
>
> The patch is located at:
>
> http://www.creative.net.au/squid/patches/squid-clientside-body.diff
>
> Any comments? No, it doesn't fix the real problem, but it looks to

minor, but I would do it like this:

Index: client_side.c
===================================================================
RCS file: /squid/squid/src/client_side.c,v
retrieving revision 1.471
diff -u -r1.471 client_side.c
--- client_side.c 2000/03/06 16:23:29 1.471
+++ client_side.c 2000/05/10 03:22:24
@@ -72,6 +72,7 @@
 /* Local functions */
 
 static CWCB clientWriteComplete;
+static CWCB clientWriteBodyComplete;
 static PF clientReadRequest;
 static PF connStateFree;
 static PF requestTimeout;
@@ -1673,6 +1674,13 @@
        }
        /* reset range iterator */
        http->range_iter.pos = HttpHdrRangeInitPos;
+ } else if (!http->request->range) {
+ /* Avoid copying to MemBuf for non-range requests */
+ /* Note, if we're here, then 'rep' is known to be NULL */
+ http->out.offset += body_size;
+ comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL);
+ /* NULL because clientWriteBodyComplete frees it */
+ return;
     }
     if (http->request->method == METHOD_HEAD) {
        if (rep) {
@@ -1765,6 +1773,14 @@
                http);
        }
     }
+}
+
+static void
+clientWriteBodyComplete(int fd, char *buf, size_t size, int errflag,
+ void *data)
+{
+ memFree(buf, MEM_CLIENT_SOCK_BUF);
+ clientWriteComplete(fd, buf, size, errflag, data);
 }
 
 static void
Received on Tue May 09 2000 - 21:23:31 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:25 MST