Go, tcp too many open files debug

前端 未结 6 881
有刺的猬
有刺的猬 2020-12-08 20:32

Here\'s a straightforward Go http (tcp) connection test script

func main() {
    ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *htt         


        
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-08 20:54

    change the ulimit to avoid the error "too many open files" by default max ulimit is 4096 for linux and 1024 for mac, u can change ulimit to 4096 by typing ulimit -n 4096 for beyond 4096 you need to modify limits.conf in etc/security folder for linux and set hard limit to 100000 by adding this line "* hard core 100000"

提交回复
热议问题