If my Rails application has the database pool size set to 5 (the default) in my database.yml file, and I'm running using Phusion Passenger, does that mean that there may be up to 5 database connections for each process that Passenger spawns, or is it 5 total across all processes?
Asked
Active
Viewed 4,642 times
1 Answers
6
The pool size applies to one ruby process. Some ruby interpreters can use threading to handle multiple requests, like jRuby. The pool size applies for that one process and all threads.
Passenger does not use threading, but instead creates new ruby processes.

Ariejan
- 10,910
- 6
- 43
- 40
-
1This actually depends on how passenger is configured to spawn rails applications. By default all connections in the pool are shared over all rails processes. That means all 5 connections are shared among all processes. http://stackoverflow.com/questions/2200586/passenger-hosted-rails-app-painfully-slow-but-the-server-is-a-beast – Horacio Jul 22 '11 at 09:18
-
@Horacio: someone from Phusion [disputes that post's claim that connections are shared](https://groups.google.com/forum/#!topic/phusion-passenger/hfdeaysTqPo). – twelve17 Apr 08 '14 at 12:05
-
I can't reply to the Google groups phusion post anymore, but a common problem I see at customers that work with the 1 connection per process are their monitoring tools. So yes a passenger process will only have 1 thread and need 1 connection to the database pool, but remember to assign an extra connection for monitoring tools like NewRelic, since these monitoring tools will permanently occupy a connection for database monitoring. – HendrikPetertje Aug 05 '20 at 08:29