• 请不要在回答技术问题时复制粘贴 AI 生成的内容
weiruanniubi
V2EX  ›  程序员

NGINX 的 fastopen 这个值填多少比较合适?

  •  
  •   weiruanniubi · Sep 12, 2019 · 4933 views
    This topic created in 2620 days ago, the information mentioned may be changed or developed.

    这个值还是当初直接复制网上教程的,填的 3。
    想知道这个值有没有什么依据,目前配置是 1C1G1M,填多少最好呢?

    11 replies  •  2019-09-12 15:45:24 +08:00
    PureWhiteWu
    PureWhiteWu
    Sep 12, 2019
    1
    请自己先 Google。
    去看看内核中对于 fastopen 值的定义是什么就能理解了。
    weiruanniubi
    weiruanniubi
    OP
    Sep 12, 2019
    2
    @PureWhiteWu 内核的值我知道,1 是服务端开启,2 是客户端开始,3 是全部开启。但是 NGINX 的我不理解,谷歌也没有。
    ysc3839
    ysc3839
    Sep 12, 2019 via Android
    3
    fastopen=number
    enables “TCP Fast Open” for the listening socket (1.5.8) and limits the maximum length for the queue of connections that have not yet completed the three-way handshake.
    Do not enable this feature unless the server can handle receiving the same SYN packet with data more than once.
    http://nginx.org/en/docs/http/ngx_http_core_module.html
    PureWhiteWu
    PureWhiteWu
    Sep 12, 2019
    4
    https://nginx.org/en/docs/http/ngx_http_core_module.html
    只能帮你到这里了。
    自行关键字搜索。
    swulling
    swulling
    Sep 12, 2019
    5
    首先你的内核必须支持并且开启了 fastopen

    然后这个 number 应该就是 limits the maximum length for the queue of connections that have not yet completed the three-way handshake 里的 limits

    写 3 有点小把,可以改成 500

    具体是否生效,可以用 tcpdump 把包 dump 出来看看
    weiruanniubi
    weiruanniubi
    OP
    Sep 12, 2019
    6
    @ysc3839
    @PureWhiteWu
    看完之后,我决定还是禁用了吧……
    weiruanniubi
    weiruanniubi
    OP
    Sep 12, 2019
    7
    @swulling 去掉了,感觉弊大于利的样子……
    swulling
    swulling
    Sep 12, 2019 via iPhone
    8
    国内的配置文档就是瞎 JB 抄,有人按照内核的习惯设置为 3,结果都变成了 3,也没一个人验证下到底开启了没有。 国外的文章就很正常,还有 test code。
    swulling
    swulling
    Sep 12, 2019 via iPhone
    9
    @weiruanniubi 还好,主要是降低了 latency。看你的应用是否对 latency 敏感。
    weiruanniubi
    weiruanniubi
    OP
    Sep 12, 2019
    10
    @swulling 是的,我也觉得是把内核值和这个搞混了……
    6IbA2bj5ip3tK49j
    6IbA2bj5ip3tK49j
    Sep 12, 2019
    11
    这种参数一般两种选择
    + 看官网文档,调整之后自己测试。
    + 假装不存在,直接删掉用默认的。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2004 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 05:42 · PVG 13:42 · LAX 21:42 · JFK 00:42
    ♥ Do have faith in what you're doing.