Thanks, Jeremy. It works.
But the document could be more specific. At first, I did not know how to set connection_expiration_timeout, but found it out by spec test. I have committed pull request for the document. 在 2016年8月7日星期日 UTC+8上午2:08:09,Jeremy Evans写道: > > On Friday, August 5, 2016 at 10:58:00 PM UTC-7, Wang wrote: >> >> I am using Sequel with Postgresql, and set :max_connections => 20. >> In Sequel, it seems that once connection is established, and it would >> live forever, until app exit. >> >> In production, we run more than 50 instances with Sequel, in threaded app >> server Puma. >> Under high load, all threads are busy, and Postgresql would have more >> than 1k connections. >> After the system load going down, the connections are still there, in >> idle state. >> >> Though we could close idle connections in Postgresql, but it would be >> dangerous for ruby clients. >> >> Is there any way to close idle connection with timeout, or limit the >> number of idle connection, like SetMaxIdelConn in Golang >> <http://go-database-sql.org/connection-pool.html>. >> > > The connection_expiration plugin should be able to do what you want, > though it's based on time since initial connection and not based on load. > > Thanks, > Jeremy > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
