1m websocket use go Posted on 2019-02-22 In golang 原文链接 解决too many files every socket is represented by a file descriptor optimization: goroutines 在goroutines部分,采用epoll的方式 123456789fd, err := unix.EpollCreatel(0)if err != nil { return nil, err}fd := websocketFD(conn)err := unix.EpollCtl(e.fd, syscall.EPOLL_CTL_ADD, fd, &unix.EpollEvent{}..)if err !=nil { return err} reduce 30% buffers allocations github.com/gobwas/ws reduce 97% *