gpt4 book ai didi

go - net/http 服务器在 ab (ApacheBench) 重负载下卡住

转载 作者:数据小太阳 更新时间:2023-10-29 03:42:49 25 4
gpt4 key购买 nike

MacOS 上的 Golang net/http 服务器在 16000 个请求后卡住:

$ ab -c 4 -n 20000 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 2000 requests
Completed 4000 requests
...
Completed 14000 requests
Completed 16000 requests
^C

最佳答案

以下是 Bill Neubauer 的解释:

This issue is caused by the OS running out of sockets. ab and Go are cycling through socket pairs for communication faster than the OS can reallocate them for reuse.

引用https://github.com/golang/go/issues/66#issuecomment-66047858

关于go - net/http 服务器在 ab (ApacheBench) 重负载下卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56088332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com