Re: squid + ftp = degraded performance? [solution?]

From: Arjan de Vet <Arjan.deVet@dont-contact.us>
Date: Mon, 3 Mar 1997 18:23:02 +0100 (MET)

In article <Pine.LNX.3.95.970221120246.23319I-100000@saruman.esoterica.pt>
you write:

> Well, the same hapens with our proxy, and this only started after
>upgrading from squid 1.1.0 to 1.1.2. The current solution is to use a

I checked the changes to comm.c between 1.1.1 and 1.1.2 and backed out
those changes on my Squid 1.1.5 proxy (patch at the end). I'm not sure
what exactly causes the problem so I backed out the whole code instead of
trying the find the real problem.

The performance of my 1.1.5 squid is now as it used to be but it's 18:00h
here so I am only sure after tomorrow (when the real traffic hits my
cache) whether it really solved this very annoying problem.

Let me know if it solves your performance problem too.

Arjan

--- comm.c.ORIG Mon Mar 3 17:51:56 1997
+++ comm.c Mon Mar 3 17:52:08 1997
@@ -620,17 +620,13 @@
 comm_select_incoming(void)
 {
     int fd = 0;
- int fds[4];
+ int fds[3];
     struct pollfd pfds[3];
- unsigned long N = 0;
- unsigned long i = 0;
- int dopoll = 0;
+ int N = 0;
+ int i = 0;
     PF hdl = NULL;
     if (theInIcpConnection >= 0)
         fds[N++] = theInIcpConnection;
- if (theInIcpConnection != theOutIcpConnection)
- if (theOutIcpConnection >= 0)
- fds[N++] = theOutIcpConnection;
     if (theHttpConnection >= 0 && fdstat_are_n_free_fd(RESERVED_FD))
         fds[N++] = theHttpConnection;
     fds[N++] = 0;
@@ -641,18 +637,14 @@
         pfds[i].fd = fd;
         if (fd_table[fd].read_handler) {
             pfds[i].events |= POLLRDNORM;
- dopoll++;
         }
         if (fd_table[fd].write_handler) {
             pfds[i].events |= POLLWRNORM;
- dopoll++;
         }
         if (pfds[i].events == 0)
             pfds[i].fd = -1;
     }
- if (!dopoll)
- return;
- if (poll(pfds, N, 0) < 1)
+ if (poll(pfds, (unsigned long) N, 0) < 1)
         return;
     getCurrentTime();
     for (i = 0; i < N; i++) {
@@ -682,7 +674,7 @@
     fd_set write_mask;
     int maxfd = 0;
     int fd = 0;
- int fds[4];
+ int fds[3];
     int N = 0;
     int i = 0;
     PF hdl = NULL;
@@ -692,9 +684,6 @@
         fds[N++] = theHttpConnection;
     if (theInIcpConnection >= 0)
         fds[N++] = theInIcpConnection;
- if (theInIcpConnection != theOutIcpConnection)
- if (theOutIcpConnection >= 0)
- fds[N++] = theOutIcpConnection;
     fds[N++] = 0;
     for (i = 0; i < N; i++) {
         fd = fds[i];
@@ -741,7 +730,7 @@
     int fd;
     int i;
     int maxfd;
- unsigned long nfds;
+ int nfds;
     int incnfd;
     int num;
     int httpindex;
@@ -806,7 +795,7 @@
             return COMM_SHUTDOWN;
         for (;;) {
             poll_time = sec > 0 ? 1000 : 0;
- num = poll(pfds, nfds, poll_time);
+ num = poll(pfds, (unsigned long) nfds, poll_time);
             getCurrentTime();
             if (num >= 0)
                 break;
@@ -840,7 +829,7 @@
         if (num == 0)
             continue;
         /* scan each socket but the accept socket. Poll this
- * more frequently to minimize losses due to the 5 connect
+ * more frequently to minimiize losses due to the 5 connect
          * limit in SunOS */
         for (i = 0; i < nfds; i++) {
             fd = pfds[i].fd;
@@ -851,11 +840,7 @@
              * Don't forget to keep the UDP acks coming and going.
              */
             comm_select_incoming();
- if (fd == theInIcpConnection)
- continue;
- if (fd == theOutIcpConnection)
- continue;
- if (fd == theHttpConnection)
+ if ((fd == theInIcpConnection) || (fd == theHttpConnection))
                 continue;
             if (pfds[i].revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
                 debug(5, 6, "comm_select: FD %d ready for reading\n", fd);
@@ -863,7 +848,6 @@
                     hdl = fd_table[fd].read_handler;
                     fd_table[fd].read_handler = 0;
                     hdl(fd, fd_table[fd].read_data);
- comm_select_incoming();
                 }
             }
             if (pfds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
@@ -872,7 +856,6 @@
                     hdl = fd_table[fd].write_handler;
                     fd_table[fd].write_handler = 0;
                     hdl(fd, fd_table[fd].write_data);
- comm_select_incoming();
                 }
             }
             if (pfds[i].revents & POLLNVAL) {
@@ -1004,7 +987,7 @@
             continue;
 
         /* scan each socket but the accept socket. Poll this
- * more frequently to minimize losses due to the 5 connect
+ * more frequently to minimiize losses due to the 5 connect
          * limit in SunOS */
 
         for (fd = 0; fd < maxfd; fd++) {
@@ -1017,11 +1000,7 @@
              */
             comm_select_incoming();
 
- if (fd == theInIcpConnection)
- continue;
- if (fd == theOutIcpConnection)
- continue;
- if (fd == theHttpConnection)
+ if ((fd == theInIcpConnection) || (fd == theHttpConnection))
                 continue;
 
             if (FD_ISSET(fd, &readfds)) {
@@ -1030,7 +1009,6 @@
                     hdl = fd_table[fd].read_handler;
                     fd_table[fd].read_handler = 0;
                     hdl(fd, fd_table[fd].read_data);
- comm_select_incoming();
                 }
             }
             if (FD_ISSET(fd, &writefds)) {
@@ -1039,7 +1017,6 @@
                     hdl = fd_table[fd].write_handler;
                     fd_table[fd].write_handler = 0;
                     hdl(fd, fd_table[fd].write_data);
- comm_select_incoming();
                 }
             }
         }
Received on Mon Mar 03 1997 - 09:54:08 MST

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