# A second production environment

**URL:** <https://www.ruby-forum.com/t/a-second-production-environment/188570>\
**Category:** Rails\
**Created:** [May 14, 2010, 1:39am UTC](https://www.ruby-forum.com/t/a-second-production-environment/188570 "2010-05-14T01:39:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [May 14, 2010, 1:39am UTC](https://www.ruby-forum.com/t/a-second-production-environment/188570/1 "2010-05-14T01:39:35Z")

</div>

Hi,

I’m attempting to create a second production environment, because I have  
multiple databases to maintain, and production is much faster. So now I  
have 2 ‘production style’ environments, called ‘production’ and  
‘apiloc\_production’

To create the apiloc\_production environment, I added a new entry in  
database.yml:

apiloc\_production:  
adapter: postgresql  
database: apiloc  
timeout: 5000

I also created an apiloc\_production.rb file in config/environments by  
simply copying production.rb (attached). There is no difference between  
these files.

I expected that ‘production’ and ‘apiloc\_production’ environments would  
behave in the same way, with the exception that different databases  
would be accessed. However, this is not the case. apiloc\_production is  
much slower (~10x) than production, and apiloc\_production logs SQL  
queries to its log file, whereas production doesn’t.

So I’m confused - how can I make apiloc\_production act more like  
production? Is ‘production’ environment treated differently under the  
hood of rails somehow?

Thanks,  
ben

running rails 2.3.5, ruby 1.8.7

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [May 14, 2010, 1:55pm UTC](https://www.ruby-forum.com/t/a-second-production-environment/188570/2 "2010-05-14T13:55:05Z")

</div>

First simple question:

Have you compared the log files for those two environments? Is your  
second “production” environment really being treated as production?

Sounds like you’re getting all the dev class reloading and logging, just  
like a non-production environment.

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [May 14, 2010, 2:38pm UTC](https://www.ruby-forum.com/t/a-second-production-environment/188570/3 "2010-05-14T14:38:49Z")

</div>

Ar Chron wrote:

> First simple question:
> 
> Have you compared the log files for those two environments? Is your  
> second “production” environment really being treated as production?
> 
> Sounds like you’re getting all the dev class reloading and logging, just  
> like a non-production environment.

Thanks for the help. The apiloc\_production log file is different than  
the production log file, because the apiloc\_production is filled with  
SQL queries, whereas the production log file is empty except for the  
time of it’s creation.

I wonder idly, could this be caused somehow by plugins that treat the  
environments differently? I’ll have a go trying to figure that out and  
get back to the list.

Any other ideas on how to fix this? Thanks,  
ben
