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

手撸 C++ HTTP 服务器, ab 测试时大量的 TIME_WAIT 状态占用端口一般怎么处理?

  •  
  •   zhongrs232 · Feb 3, 2020 · 2945 views
    This topic created in 2470 days ago, the information mentioned may be changed or developed.
    主要是目前还不支持 keepalive,服务器每次服务完后都要断开连接,这样 ab 测试就会出现一大堆 TIME_WAIT 状态的端口,多到一定数量就测不下去了
    5 replies  •  2020-02-03 17:36:25 +08:00
    theTd
    theTd
    Feb 3, 2020
    1
    SO_REUSEADDR 试过吗
    abbycin
    abbycin
    Feb 3, 2020
    2
    设置 linger 啊
    GeminiPro
    GeminiPro
    Feb 3, 2020
    3
    设置长链接
    GeminiPro
    GeminiPro
    Feb 3, 2020
    4
    SO_LINKGER
    zhongrs232
    zhongrs232
    OP
    Feb 3, 2020
    5
    明白了,研究了一下 SO_LINGER,确实可以用这个
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1446 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:30 · PVG 19:30 · LAX 03:30 · JFK 06:30
    ♥ Do have faith in what you're doing.