Steven McPhillips
2012-11-12 02:43:13 UTC
Hi,
I have an interesting issue with one of my Ruby+Sequel web apps. The app is
very infrequently used, and the (MySQL) dba employs fairly aggressive
connection pruning. This means that connections in Sequel's db pool are
almost always invalidated when a request comes through (because MySQL has
disconnected them). My immediate thought was to reduce the max_connections
option (Sequel.connect) to 1, but I have a feeling (confirmed?<https://groups.google.com/d/topic/sequel-talk/yb_u0uDiCDk/discussion> I've
been lazy and not tested for myself) doing so would mean the app would only
have 1 active db connection.
So my question: can I configure Sequel to not pool connections, but still
ensure each request can access a (freshly minted as required) db
connection, perhaps with an upper limit on maximum active connections? Am I
just getting confused between db.max_connections vs db.pool.max_connections?
I'm running Sequel v3.41.0.
catching Sequel::DatabaseDisconnectError to automatically retry (somewhat
end
I have an interesting issue with one of my Ruby+Sequel web apps. The app is
very infrequently used, and the (MySQL) dba employs fairly aggressive
connection pruning. This means that connections in Sequel's db pool are
almost always invalidated when a request comes through (because MySQL has
disconnected them). My immediate thought was to reduce the max_connections
option (Sequel.connect) to 1, but I have a feeling (confirmed?<https://groups.google.com/d/topic/sequel-talk/yb_u0uDiCDk/discussion> I've
been lazy and not tested for myself) doing so would mean the app would only
have 1 active db connection.
So my question: can I configure Sequel to not pool connections, but still
ensure each request can access a (freshly minted as required) db
connection, perhaps with an upper limit on maximum active connections? Am I
just getting confused between db.max_connections vs db.pool.max_connections?
I'm running Sequel v3.41.0.
Sequel.connect(jdbc:mysql://localhost:3306/stats?user=test&zeroDateTimeBehavior=convertToNull, :max_connections
=> 10)
Using the db connection is achieved by yielding it, and=> 10)
catching Sequel::DatabaseDisconnectError to automatically retry (somewhat
5.times do
begin
rescue Sequel::DatabaseDisconnectError => e
Log.info("Connecting to the database failed. Retrying...")
sleep(2)begin
rescue Sequel::DatabaseDisconnectError => e
Log.info("Connecting to the database failed. Retrying...")
end
end
--
You received this message because you are subscribed to the Google Groups "sequel-talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/xRGys-4-uRQJ.
To post to this group, send email to sequel-talk-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to sequel-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
You received this message because you are subscribed to the Google Groups "sequel-talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/xRGys-4-uRQJ.
To post to this group, send email to sequel-talk-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to sequel-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.