-2

Golang net/http server on MacOS freezes after 16000 requests:

$ 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
Dmitry Mottl
  • 842
  • 10
  • 17

1 Answers1

-2

Following is the explanation by 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.

Refer to https://github.com/golang/go/issues/66#issuecomment-66047858

Dmitry Mottl
  • 842
  • 10
  • 17