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.
