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

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

  •  
  •   zhongrs232 · Feb 3, 2020 · 2551 views
    This topic created in 2298 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
        1
    theTd  
       Feb 3, 2020
    SO_REUSEADDR 试过吗
    abbycin
        2
    abbycin  
       Feb 3, 2020
    设置 linger 啊
    GeminiPro
        3
    GeminiPro  
       Feb 3, 2020
    设置长链接
    GeminiPro
        4
    GeminiPro  
       Feb 3, 2020
    SO_LINKGER
    zhongrs232
        5
    zhongrs232  
    OP
       Feb 3, 2020
    明白了,研究了一下 SO_LINGER,确实可以用这个
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   977 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 20:22 · PVG 04:22 · LAX 13:22 · JFK 16:22
    ♥ Do have faith in what you're doing.