zoukankan      html  css  js  c++  java
  • 通过nginx 499 来判断服务端超时数量

    这个其实不能算一篇文章,因为内容太少了,就当记点笔记吧。

    (1)什么是 nginx 499

      499 其实是 nginx 下特有的 http 状态码,代表客户端主动断开了连接,导致服务器无法返回 http 请求头。

      google 的解释: 

        A non-standard status code introduced by nginx for the case when a client closes the connection while nginx is processing the request, making server unable to send the HTTP header back. 

    (2)nginx 499 状态码有什么作用

      显然,如题,可以通过统计 nginx 日志中的 499 数量来判断有多少请求超出了客户端设置的超时时间,当然,如果服务端记录了请求的耗时,还可以由此判断客户端的超时时间是多少。

      如果要统计超时的数量,在 nginx 日志文件夹下执行如下指令即可:

    [worker@******-sh-100-E08 2017-07-05]$ grep ' 499 ' * | wc -l
    60

      如果要查看客户端设置的超时时间,只需要查看落日志时 nginx 的时间即可:

    xxx-2017-07-05-12.log:xxx xxx1.xxx "10.xx.xx.14|10.xx.xx.167:9000|-" [05/Jul/2017:12:26:06 +0800] "1.000|-|-|-" "POST /Website/cp/cp-resource?cp_number=ifeng_fm&rid=0GinAnBb%2C0GinAnBb HTTP/1.0" 499 0 "-" "-" "-"

      如上这条日志可以看出,执行时间为 1.000秒,即客户端的超时时间为 1 秒

  • 相关阅读:
    C 语言 静态库和动态库的创建和应用
    C++ 中英文术语对照
    下午
    [转]内核 do_fork 函数源代码浅析
    关于C#反射机制,自己写的
    获取字符串中数字
    关于C#反射机制,来源于网络
    关于 Nhinernate 的one to one(转载)
    鼠标坐标的记录
    关于C#中hibernate.cfg.xml动态加载问题
  • 原文地址:https://www.cnblogs.com/smallrookie/p/7122798.html
Copyright © 2011-2022 走看看