Ok. Try this updated patch which tries to take ICP status into account
when selecting parents based on statistical RTT. This is done by
ignoring peers wich replied with a "odd" ICP status code on the last ICP
query.
(this time structs.h is changed, so don't forget to make clean)
/Henrik
John Line (as web server manager) wrote:
> No, it was a while after startup. However, cam0.sites was continually
> reported as "TCP connection failed". It was also reporting ICP_MISS_NOFETCH
> when it managed to send an ICP response (though until I got the debug
> options sorted out, it wasn't clear which peer was sending those response).
> So ... for requests done directly in response to ICP queries, cam0.sites
> would not get used, but when using RTT estimates without having any ICP
> responses, it looks as good as any of the others... It seems to handle HTTP
> requests OK, in spite of the ICP_MISS_NOFETCH reesponses.
[ Part 2: "Attached Text" ]
Index: squid/src/neighbors.c
diff -u squid/src/neighbors.c:1.1.1.31.6.4 squid/src/neighbors.c:1.1.1.31.6.7
--- squid/src/neighbors.c:1.1.1.31.6.4 Sat May 8 14:28:45 1999
+++ squid/src/neighbors.c Sun May 9 07:50:43 1999
@@ -239,6 +239,34 @@
}
peer *
+getLowestRttParent(request_t * request)
+{
+ peer *p;
+ peer *p_rtt = NULL;
+ for (p = Config.peers; p; p = p->next) {
+ if (!p->stats.icp_last_reply_ok)
+ continue;
+ if (!neighborUp(p))
+ continue;
+ if (neighborType(p, request) != PEER_PARENT)
+ continue;
+ if (!peerHTTPOkay(p, request))
+ continue;
+ if (!peerWouldBePinged(p, request))
+ continue;
+ if (!p_rtt || p->stats.rtt < p_rtt->stats.rtt)
+ p_rtt = p;
+ }
+ if (p_rtt)
+ debug(15, 3) ("getLowestRttParent: returning %s RTT %d msec\n", p_rtt->host, p_rtt->stats.rtt);
+ else
+ debug(15, 4) ("getLowestRttParent: none found\n");
+ return p_rtt;
+}
+
+
+
+peer *
getRoundRobinParent(request_t * request)
{
peer *p;
@@ -752,8 +780,20 @@
if (opcode > ICP_END)
return;
opcode_d = icp_opcode_str[opcode];
- if (p)
+ if (p) {
neighborUpdateRtt(p, mem);
+ switch(opcode) {
+ case ICP_HIT:
+ case ICP_MISS:
+ case ICP_HIT_OBJ:
+ case ICP_DECHO:
+ p->stats.icp_last_reply_ok = 1;
+ break;
+ default:
+ p->stats.icp_last_reply_ok = 0;
+ break;
+ }
+ }
/* Does the entry exist? */
if (NULL == entry) {
debug(12, 3) ("neighborsUdpAck: Cache key '%s' not found\n",
Index: squid/src/peer_select.c
diff -u squid/src/peer_select.c:1.1.1.27.2.5 squid/src/peer_select.c:1.1.1.27.2.6
--- squid/src/peer_select.c:1.1.1.27.2.5 Fri May 7 16:19:25 1999
+++ squid/src/peer_select.c Sat May 8 16:23:22 1999
@@ -392,6 +392,10 @@
if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
p = whichPeer(&ps->closest_parent_miss);
code = CLOSEST_PARENT_MISS;
+ } else if (ps->ping.timedout) {
+ /* ICP pinging timedout, use estimated rtt's for selecing parent */
+ p = getLowestRttParent(request);
+ code = FIRST_PARENT_MISS;
} else if (ps->first_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
p = whichPeer(&ps->first_parent_miss);
code = FIRST_PARENT_MISS;
Index: squid/src/protos.h
diff -u squid/src/protos.h:1.1.1.39.4.2 squid/src/protos.h:1.1.1.39.4.3
--- squid/src/protos.h:1.1.1.39.4.2 Wed May 5 11:33:51 1999
+++ squid/src/protos.h Sat May 8 16:23:22 1999
@@ -587,6 +587,7 @@
extern peer *getFirstPeer(void);
extern peer *getFirstUpParent(request_t *);
+extern peer *getLowestRttParent(request_t *);
extern peer *getNextPeer(peer *);
extern peer *getSingleParent(request_t *);
extern int neighborsCount(request_t *);
Index: squid/src/structs.h
diff -u squid/src/structs.h:1.1.1.37.6.3 squid/src/structs.h:1.1.1.37.6.4
--- squid/src/structs.h:1.1.1.37.6.3 Wed May 5 11:33:52 1999
+++ squid/src/structs.h Sun May 9 07:50:44 1999
@@ -1009,6 +1009,7 @@
time_t last_connect_failure;
time_t last_connect_probe;
int logged_state; /* so we can print dead/revived msgs */
+ int icp_last_reply_ok; /* did it accept a request? */
} stats;
struct {
int version;
Received on Tue Jul 29 2003 - 13:15:58 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:07 MST