Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)

Can't connect to MySQL server Lost connection to MySQL server during query · Issue #269 · PyMySQL/PyMySQL https://github.com/PyMySQL/PyMySQL/issues/269

Hey all -

I was able to track down my issue with the help of amazon engineers.
We use an RDS as our backend MySQL server and we were sending too many connections for the RDS to handle.

The default somaxconn value for an amazon RDS instance is 128 and they bumped it up to 1024 for us.

After the change we've been good.

Here's a little bit more explanation:

/proc/sys/net/core/somaxconn: Limit of socket listen() backlog, known in userspace as SOMAXCONN. Defaults to 128. The value should be raised substantially to support bursts of request. For example, to support a burst of 1024 requests, set somaxconn to 1024.

https://computing.llnl.gov/linux/slurm/high_throughput.html

Linux Clusters Overview https://computing.llnl.gov/tutorials/linux_clusters/

原文地址:https://www.cnblogs.com/rsapaper/p/10206989.html