My Rails application requires a very busy worker process running in the
background at all times. I am launching this non-interactive process
using script/runner. This process is very busy and is communicating
with the MySQL server constantly. As I started putting some load on the
system to test, I started running into performance issues.
I have since discovered that Rails is only using 1 database connnection
in this context. When monitoring the database, MySQL reports only 1
connection and 1 thread, even during very busy times. It doesn’t look
like Rails is using database connection pooling when ActiveRecord is
being used in this context (stand alone).
The big question: How can I get database connection pooling when
running a non-interactive Rails application via script/runner?
Without this I may be dead in the water.