Go net/http服务器在ab(ApacheBench)重载下冻结

Go net/http服务器在ab(ApacheBench)重载下冻结,go,httpserver,Go,Httpserver,MacOS上的Golangnet/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 Fou

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
$ab-c4-n20000http://127.0.0.1:8080/
这是ApacheBench,版本2.3
版权1996亚当·特维斯,宙斯科技有限公司,http://www.zeustech.net/
许可给Apache软件基金会,http://www.apache.org/
基准127.0.0.1(耐心等待)
已完成2000项请求
已完成4000个请求
...
已完成14000个请求
已完成16000个请求
^C

以下是比尔·纽鲍尔的解释:

此问题是由操作系统的套接字不足引起的。ab和Go是 通过套接字对进行循环以比操作系统更快的速度进行通信 重新分配它们以供重用