In production I''ve setup a mongrel cluster of 2 servers. Now I''m using RJB(ruby java bridge). So I need certain java environment variables set before mongrel starts. So I set them: export LD_LIBRARY_PATH=/usr/java/jdk1.6.0/jre/lib/i386/:/usr/java/jdk1.6.0/jre/lib/i386/client/:./ export JAVA_HOME=/usr/java/jdk1.6.0/ Then I run "mongrel_rails cluster::start". Now for whatever reason only the first server in the cluster seems have the environment variables set. Like as if the environment is getting blanked out after the first server starts but before the second. So I on the page using RJB. I end up with this weird refresh problem. Where it works, then errors, works, error, etc. I''m using rails 1.2.1 and mongrel 1.0.1 and cluster 0.2.1. If that helps. -- Jason Yates jaywhy at gmail.com
I should have responded earlier to myself. Just in case others have similar problems in the future. The problem wasn''t mongrel at all. However, the issue seemed to be coming from mongrel, because for whatever reason an error from Rjb wasn''t getting logged The problem was Java was eating up all the available memory. Because each mongrel instance would start its own Java process. The first one would steal all the available memory. Then the second couldn''t even start because no memory was available. Hence one mongrel instance would work the other wouldn''t The JRE does this because it checks for available system memory and allocates a portion of it. Which is fine, however in my case I''m using a virtual server. So I only had a 256mb portion of the 4gbs Java thought it had to play with. Anyways I blogged about it. If anyone cares. http://jaywhy.wordpress.com/2007/03/05/pdf-templates-via-rails/ On 2/23/07, Jason Yates <jaywhy at gmail.com> wrote:> In production I''ve setup a mongrel cluster of 2 servers. Now I''m > using RJB(ruby java bridge). So I need certain java environment > variables set before mongrel starts. > > So I set them: > > export LD_LIBRARY_PATH=/usr/java/jdk1.6.0/jre/lib/i386/:/usr/java/jdk1.6.0/jre/lib/i386/client/:./ > export JAVA_HOME=/usr/java/jdk1.6.0/ > > Then I run "mongrel_rails cluster::start". > > Now for whatever reason only the first server in the cluster seems > have the environment variables set. Like as if the environment is > getting blanked out after the first server starts but before the > second. > > So I on the page using RJB. I end up with this weird refresh problem. > Where it works, then errors, works, error, etc. > > I''m using rails 1.2.1 and mongrel 1.0.1 and cluster 0.2.1. If that helps. > > -- > Jason Yates > jaywhy at gmail.com >-- Jason Yates jaywhy at gmail.com
On 3/5/07, Jason Yates <jaywhy at gmail.com> wrote:> I should have responded earlier to myself. Just in case others have > similar problems in the future. > > The problem wasn''t mongrel at all. However, the issue seemed to be > coming from mongrel, because for whatever reason an error from Rjb > wasn''t getting logged > > The problem was Java was eating up all the available memory. Because > each mongrel instance would start its own Java process. The first one > would steal all the available memory. Then the second couldn''t even > start because no memory was available. Hence one mongrel instance > would work the other wouldn''t >You should have used BackgrounDrb and some queue/method to communicate with your mongrel_cluster instead, that way, only one java process will be running.> The JRE does this because it checks for available system memory and > allocates a portion of it. Which is fine, however in my case I''m > using a virtual server. So I only had a 256mb portion of the 4gbs > Java thought it had to play with. > > Anyways I blogged about it. If anyone cares. > > http://jaywhy.wordpress.com/2007/03/05/pdf-templates-via-rails/ >Still long-running process or process that eat a lot of resources from your web application is wise, injecting them into the whole web serving experience is a pain to debug. Good to knwo you solved this. -- Luis Lavena Multimedia systems - Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile. Vince Lombardi