gorm golang concurrent connection database error solution
- 2020-07-21 08:31:02
- OfStack
Bottom error error: cannot assign requested address
why
In the concurrent scenario, client frequently requests the port to establish an tcp connection, resulting in the port being exhausted
The solution
root will do
sysctl-w ES21en. ipv4.tcp_timestamps=1 turns on support for TCP timestamp. If this is set to 0, the following setting does not work
sysctl-w net.ipv4.tcp_tw_recycle=1 means to enable quick recovery of ES36en-ES37en sockets in TCP connection