This replace to gws has improved the IO methodology, with a peak IOPS improve of about 37% for 1000 connections, reaching 3 instances that of gorilla/websocket, and lowering reminiscence consumption to the identical degree as gorilla/websocket. The main points of the development are as follows:
- Use io.Reader as an alternative of io.CopyN to learn knowledge, avoiding pointless allocs
- Use internet.Buffers as an alternative of bufio.Author to jot down knowledge and cut back reminiscence copies
- Take away bufio.Author from the connection, mark WriteBufferSize parameter as deprecated
Repo: github.com/lxzan/gws