Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phusion Passenger and database pooling

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?

like image 903
Jacob Mattison Avatar asked Sep 30 '09 16:09

Jacob Mattison


People also ask

When should you not use connection pooling?

You reuse a prior database connection, in a new context to avoid the cost of setting up a new database connection for each request. The primary reason to avoid using database connections is that you're application's approach to solving problems isn't structured to accommodate a database connection pool.

What is DB pooling?

What is database connection pooling? Database connection pooling is a way to reduce the cost of opening and closing connections by maintaining a “pool” of open connections that can be passed from database operation to database operation as needed.

How do DB connection pools work?

Connection pooling means that connections are reused rather than created each time a connection is requested. To facilitate connection reuse, a memory cache of database connections, called a connection pool, is maintained by a connection pooling module as a layer on top of any standard JDBC driver product.

What are three advantages of connection pooling?

Connection pooling often improves application performance, concurrency and scalability.


1 Answers

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.

like image 72
Ariejan Avatar answered Sep 20 '22 21:09

Ariejan