如何避免“连接过多”

2019-04-24 15:52:26.526 9818 ERROR oslo_messaging.rpc.server [req-857fec8a-7196-4425-85e4-389e2655a2c3 - - - - -] Exception during message handling: OperationalError: (pymysql.err.OperationalError) (1040, u'Too many connections') (Background on this error at: http://sqlalche.me/e/e3q8)

I used

"github.com/astaxie/beego/orm"
mariaDB

I can increase the number of connection. But is there any way to disconnect my connection if we log out of the website. Any other recommendation to use better beego+mariadb ?

  • Decrease wait_timeout.
  • Decrease the number of clients (Apache, for example, defaults to too big a number)
  • Check on the "persistent connection" and "connection pooling" you may be using.