diff options
author | Xavier Noria <fxn@hashref.com> | 2012-02-26 12:22:31 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-02-26 12:46:37 -0800 |
commit | 9b2c38b7bd582d9712c3779294a9bccde7bbd548 (patch) | |
tree | 5edc0af04c68c5385dddb91a400a3fb20c18698d /railties | |
parent | 74bc920e84b985724a93c10a3ff21090ed1b9f8e (diff) | |
download | rails-9b2c38b7bd582d9712c3779294a9bccde7bbd548.tar.gz rails-9b2c38b7bd582d9712c3779294a9bccde7bbd548.tar.bz2 rails-9b2c38b7bd582d9712c3779294a9bccde7bbd548.zip |
let the connection pool of new applications have size 1 rather than 5
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.
Diffstat (limited to 'railties')
4 files changed, 36 insertions, 12 deletions
diff --git a/railties/guides/code/getting_started/config/database.yml b/railties/guides/code/getting_started/config/database.yml index 51a4dd459d..32a998ad72 100644 --- a/railties/guides/code/getting_started/config/database.yml +++ b/railties/guides/code/getting_started/config/database.yml @@ -6,7 +6,9 @@ development: adapter: 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 # Warning: The database defined as "test" will be erased and @@ -15,11 +17,15 @@ development: test: adapter: 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 production: adapter: 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 diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml index c3349912aa..950016ad92 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml @@ -12,7 +12,9 @@ development: adapter: mysql2 encoding: utf8 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 password: <% if mysql_socket -%> @@ -28,7 +30,9 @@ test: adapter: mysql2 encoding: utf8 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 password: <% if mysql_socket -%> @@ -41,7 +45,9 @@ production: adapter: mysql2 encoding: utf8 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 password: <% if mysql_socket -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index f08f86aac3..a8ed15c2dc 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml @@ -16,7 +16,9 @@ development: adapter: postgresql encoding: unicode 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 %> password: @@ -42,7 +44,9 @@ test: adapter: postgresql encoding: unicode 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 %> password: @@ -50,6 +54,8 @@ production: adapter: postgresql encoding: unicode 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 %> password: diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml index 51a4dd459d..32a998ad72 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml @@ -6,7 +6,9 @@ development: adapter: 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 # Warning: The database defined as "test" will be erased and @@ -15,11 +17,15 @@ development: test: adapter: 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 production: adapter: 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 |