# Connection Management

**URL:** <https://www.ruby-forum.com/t/connection-management/74034>\
**Category:** Rails\
**Created:** [October 29, 2006, 10:06am UTC](https://www.ruby-forum.com/t/connection-management/74034 "2006-10-29T10:06:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincpa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e19adc/32.png) [@vincpa](https://www.ruby-forum.com/u/vincpa)\
**Post date:** [October 29, 2006, 10:06am UTC](https://www.ruby-forum.com/t/connection-management/74034/1 "2006-10-29T10:06:18Z")

</div>

Hi there

It seems that a lot of the database logic is hidden away from rails and  
it would be nice to know how Rails or the MVC handles database  
connections.

The ISP im with (GoDaddy) only supports 50 mysql connections at a time  
(simultaneous) and when it comes to Rails, how do I find out when  
database connections are kept open? Is there some sort of connection  
pooling that the server must implement in order to get the maximum out  
of those 50? Does rails keep connections open when working with  
pagination?

Im basically looking for some resources on how rails maintains its  
conenctions and how it works with the database overall but google does  
not help at all.

---

<div class="post-metadata">

**Author:** ![vincpa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e19adc/32.png) [@vincpa](https://www.ruby-forum.com/u/vincpa)\
**Post date:** [November 7, 2006, 10:44am UTC](https://www.ruby-forum.com/t/connection-management/74034/2 "2006-11-07T10:44:03Z")

</div>

Vince /. wrote:

> of those 50? Does rails keep connections open when working with  
> pagination?
> 
> Im basically looking for some resources on how rails maintains its  
> conenctions and how it works with the database overall but google does  
> not help at all.

In all but the simplest server setups (e.g. WEBrick) Rails deployments  
have a front-end web server distributing requests for dynamic content to  
a number of Rails server processes. The Rails processes may be set up to  
be called through a number of different protocols, including FCGI, SCGI,  
LSAPI, and HTTP.

Each server process is limited to handling one request at a time, and  
has one database connection. (Pagination doesn’t use cursors, so doesn’t  
require successive page requests to re-use the same connection.)

If you search the archives of this list you will find advice about how  
to tune the number of server processes. A low-volume application may be  
fine with two or three server processes - you certainly shouldn’t need  
to get anywhere near the 50 processes corresponding to the DB connection  
limit.

HTH

Justin F.
