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/