From 6be2389e1b8c3e3e4ae8ff9898504acd04330fd8 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 10 Sep 1998 00:18:02 +0000 Subject: [PATCH] From: Stewart Forster Another important patch for HIGH loads. Someone mentioned once when we were designing the automatic comm_select_incoming counters tuning code that we should try not to check too often. I argued against that and I was wrong. At high loads, the sheer load of polling starts to bite badly, and so the below patch reduces the amount of polling needed. Now squid slows down more sanely at really high loads (rather than brick wall). Ideally these values should be configurable and called: incoming_icp_average 6 incoming_http_average 4 min_icp_poll_cnt 8 min_http_poll_cnt 8 but I don't have the time to write this up. These values will definately vary from site to site depending on the ICP/HHTP load ratio. The above values work okay for us, but maybe not for everyone..... The lower the poll_cnts will mean the more rapid the polling. The lower the incoming_*_average will mean the more rapid the polling. The min_*_poll_cnt will put a maximum limit on the rate of polls. --- src/cf.data.pre | 31 ++++++++++++++++++++++++++++++- src/comm_select.cc | 16 +++++++++------- src/structs.h | 8 +++++++- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/cf.data.pre b/src/cf.data.pre index a32c4f2cc6..68b43b9d6c 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.102 1998/09/09 17:47:09 wessels Exp $ +# $Id: cf.data.pre,v 1.103 1998/09/09 18:18:02 wessels Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -2546,3 +2546,32 @@ DOC_START individual host delay pool traffic allowances. DOC_END EOF + +NAME incoming_icp_average +TYPE: int +DEFAULT: 6 +LOC: Config.comm_incoming.icp_average +DOC_NONE + +NAME incoming_http_average +TYPE: int +DEFAULT: 4 +LOC: Config.comm_incoming.http_average +DOC_NONE + +NAME min_icp_poll_cnt +TYPE: int +DEFAULT: 8 +LOC: Config.comm_incoming.icp_min_poll +DOC_NONE + +NAME min_http_poll_cnt +TYPE: int +DEFAULT: 8 +LOC: Config.comm_incoming.http_min_poll +DOC_START + Heavy voodoo here. I can't even beleve you are reading this. + Are you crazy? Don't even think about adjusting these unless + you understand the algorithms in comm_select.c first! +DOC_END + diff --git a/src/comm_select.cc b/src/comm_select.cc index f0d34c23a0..bd657a4ca0 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,7 +1,7 @@ /* - * $Id: comm_select.cc,v 1.8 1998/09/04 23:04:42 wessels Exp $ + * $Id: comm_select.cc,v 1.9 1998/09/09 18:18:03 wessels Exp $ * * DEBUG: section 5 Socket Functions * @@ -216,9 +216,10 @@ comm_poll_icp_incoming(void) if (nfds == 0) return; nevents = comm_check_incoming_poll_handlers(nfds, fds); - incoming_icp_interval = incoming_icp_interval + 1 - nevents; - if (incoming_icp_interval < 0) - incoming_icp_interval = 0; + incoming_icp_interval = incoming_icp_interval + + Config.comm_incoming.icp_average - nevents; + if (incoming_icp_interval < Config.comm_incoming.icp_min_poll) + incoming_icp_interval = Config.comm_incoming.icp_min_poll; if (incoming_icp_interval > MAX_INCOMING_INTERVAL) incoming_icp_interval = MAX_INCOMING_INTERVAL; if (nevents > INCOMING_ICP_MAX) @@ -242,9 +243,10 @@ comm_poll_http_incoming(void) fds[nfds++] = HttpSockets[j]; } nevents = comm_check_incoming_poll_handlers(nfds, fds); - incoming_http_interval = incoming_http_interval + 1 - nevents; - if (incoming_http_interval < 0) - incoming_http_interval = 0; + incoming_http_interval = incoming_http_interval + + Config.comm_incoming.http_average - nevents; + if (incoming_http_interval < Config.comm_incoming.http_min_poll) + incoming_http_interval = Config.comm_incoming.http_min_poll; if (incoming_http_interval > MAX_INCOMING_INTERVAL) incoming_http_interval = MAX_INCOMING_INTERVAL; if (nevents > INCOMING_HTTP_MAX) diff --git a/src/structs.h b/src/structs.h index 5b818170c2..9aaba6d3a3 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.217 1998/09/04 23:05:04 wessels Exp $ + * $Id: structs.h,v 1.218 1998/09/09 18:18:05 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -424,6 +424,12 @@ struct _SquidConfig { } class3; } Delay; #endif + struct { + int icp_average; + int http_average; + int icp_min_poll; + int http_min_poll; + } comm_incoming; }; struct _SquidConfig2 { -- 2.47.3