Squid TCP_MISS/000 的意义

工作中需要了解Squid TCP_MISS/000 的意义,看了一下squid代码:
在代码Enums.h中:先定义了枚举量:
HTTP_STATUS_NONE = 0,

下面这个 sline结构的status,最后会赋值到在log中看到的TCP_MISS后面000这个http->code变量
这个 sline变量的status值在初始化的时候被初始化为HTTP_STATUS_NONE, 也就是0:
void
httpStatusLineInit(HttpStatusLine * sline)
{
    HttpVersion version;
    httpStatusLineSet(sline, version, HTTP_STATUS_NONE, NULL);
}

其它的 在代码中有几处在分析http header之前 设置了:
 http_status error = HTTP_STATUS_NONE;

如果系统出错会把error赋值给http->code所在的数据结构

总结起来就是在拿不到header头部进行分析的时候,log文件中的http->code这个标记为0

 

对比了一下log, TCP_MISS 后面的http->code有200,304,000三种,000这种后面的cache条目的大小标志位也为0

 

squid log的格式为:  

        logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %"PRId64" %s %s %s %s%s/%s %s/n",
                      (long int) current_time.tv_sec,
                      (int) current_time.tv_usec / 1000,
                      al->cache.msec,
                      client,
                      log_tags[al->cache.code],
                      al->http.code,
                      al->cache.size,
                      al->_private.method_str,
                      al->url,
                      user ? user : dash_str,
                      al->hier.ping.timedout ? "TIMEOUT_" : "",
                      hier_strings[al->hier.code],
                      al->hier.host,
                      al->http.content_type);

看了一下网上资料,如下:
http://www.mail-archive.com/[email protected]/msg33707.html
TCP_MISS/000 means there was no response. Usually client aborted.
NONE/- indicates Squid could not find where to send the request. I.e. probably DNS related problems.

 

Details about TCP_MISS/000 in access.log

Squid: Details about TCP_MISS/000 in access.log

I noticed some TCP_MISS/000 entries in squid access_log this afternoon, as what I saw 3 years ago.
As we know that TCP_MISS means the URL has no stored objects in cache, and TCP_MISS/000 is the bit usually means aborted, indicating there's no reply to the request before the client aborted the connection. It might be caused by the following reasons:

1, The client aborted request before SQUID could return any data
2, The website might be unavailable, due to DNS issue, network issue or an abnormal running web server.
For DNS issues, we need to check whether the dns server that used by SQUID is working as expected or not.
For network issues, we might need to check network connection status, packet lost, transfer latency or something else.
To check a web server, you can send some command to its service port, usually, you can follow this command:

$ telnet Your.Server.tld 80 [return]
GET / HTTP/1.0 [return][return]

If there is no output, you might need to restart the web server. [over]

 

 

I noticed some TCP_MISS/000 entries in squid access_log this afternoon, as what I saw 3 years ago.
As we know that TCP_MISS means the URL has no stored objects in cache, and TCP_MISS/000 is the bit usually means aborted, indicating there's no reply to the request before the client aborted the connection. It might be caused by the following reasons:

1, The client aborted request before SQUID could return any data
2, The website might be unavailable, due to DNS issue, network issue or an abnormal running web server.
For DNS issues, we need to check whether the dns server that used by SQUID is working as expected or not.
For network issues, we might need to check network connection status, packet lost, transfer latency or something else.
To check a web server, you can send some command to its service port, usually, you can follow this command:

你可能感兴趣的:(Squid TCP_MISS/000 的意义)