Skip to content

Commit

Permalink
let the connection pool of new applications have size 1 rather than 5
Browse files Browse the repository at this point in the history
The majority of Rails applications are multiprocess, people
may wonder why rails new generates a default pool of 5, does
my application need a connection pool of 5? By generating
a default of 1 database.yml is much more clear, and with
the comment people know what is the connection pool for,
and they know it has to be bigger for multithread apps.
  • Loading branch information
fxn committed Feb 26, 2012
1 parent 74bc920 commit 9b2c38b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
12 changes: 9 additions & 3 deletions railties/guides/code/getting_started/config/database.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
development: development:
adapter: sqlite3 adapter: sqlite3
database: db/development.sqlite3 database: db/development.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000


# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
Expand All @@ -15,11 +17,15 @@ development:
test: test:
adapter: sqlite3 adapter: sqlite3
database: db/test.sqlite3 database: db/test.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000


production: production:
adapter: sqlite3 adapter: sqlite3
database: db/production.sqlite3 database: db/production.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ development:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8
database: <%= app_name %>_development database: <%= app_name %>_development
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: root username: root
password: password:
<% if mysql_socket -%> <% if mysql_socket -%>
Expand All @@ -28,7 +30,9 @@ test:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8
database: <%= app_name %>_test database: <%= app_name %>_test
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: root username: root
password: password:
<% if mysql_socket -%> <% if mysql_socket -%>
Expand All @@ -41,7 +45,9 @@ production:
adapter: mysql2 adapter: mysql2
encoding: utf8 encoding: utf8
database: <%= app_name %>_production database: <%= app_name %>_production
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: root username: root
password: password:
<% if mysql_socket -%> <% if mysql_socket -%>
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ development:
adapter: postgresql adapter: postgresql
encoding: unicode encoding: unicode
database: <%= app_name %>_development database: <%= app_name %>_development
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: <%= app_name %> username: <%= app_name %>
password: password:


Expand All @@ -42,14 +44,18 @@ test:
adapter: postgresql adapter: postgresql
encoding: unicode encoding: unicode
database: <%= app_name %>_test database: <%= app_name %>_test
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: <%= app_name %> username: <%= app_name %>
password: password:


production: production:
adapter: postgresql adapter: postgresql
encoding: unicode encoding: unicode
database: <%= app_name %>_production database: <%= app_name %>_production
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
username: <%= app_name %> username: <%= app_name %>
password: password:
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
development: development:
adapter: sqlite3 adapter: sqlite3
database: db/development.sqlite3 database: db/development.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000


# Warning: The database defined as "test" will be erased and # Warning: The database defined as "test" will be erased and
Expand All @@ -15,11 +17,15 @@ development:
test: test:
adapter: sqlite3 adapter: sqlite3
database: db/test.sqlite3 database: db/test.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000


production: production:
adapter: sqlite3 adapter: sqlite3
database: db/production.sqlite3 database: db/production.sqlite3
pool: 5 # Maximum number of database connections available per process. Please
# increase this number in multithreaded applications.
pool: 1
timeout: 5000 timeout: 5000

0 comments on commit 9b2c38b

Please sign in to comment.