title: Openshift gear size and increasing Xmx
body: <p><strong>Background:</strong></p>
  
  <p>In Openshift, I am using 3 small gears each with 512m. The app has a web load balancer added to it. The web app is a tomcat 7 based app deployed with jbossews-2.0</p>
  
  <p><strong>Question 1</strong>: I read somewhere that a web load balancer will itself run in a gear. So does that mean, for scaling I have only one more gear left? Considering 1 gear in which the tomcat instance runs, 1 where load balancer run and in case load increased ill have the last one gear out of 3 to scale?</p>
  
  <p><strong>Question 2</strong>: Documentation says that each gear comes with 512m. I have configured New relic with my tomcat 7 app. I am seeing the following jvm configurations set :</p>
  
  <pre><code>-XX:MaxPermSize=102m, -XX:MinHeapFreeRatio=20, -Xms40m, -Xmx256m
  </code></pre>
  
  <p>Now if I have 512m available, am I right in thinking that I can increase the max heap to somewhat greater maybe -Xmx384m or maybe the complete 512m ?</p>
  
  <p><strong>Question 3</strong>: If yes, how to do so? I have added action hooks that indeed set the arguments but the environment settings in new relic still shows the max heap as 227m. In the provided list of arguments I see two arguments, one is my custom xmx and one comes by default</p>
  
  <pre><code>-Xms40m, -Xmx256m, -Xmx384m,
  </code></pre>
  
  <p>It seems that jvm picks the first arguments it finds which i am not sure why its not getting updated by my custom arg. To set this is what I did in my pre hook</p>
  
  <pre><code>export _JAVA_OPTIONS="$_JAVA_OPTIONS -Xmx384m -javaagent:/var/lib/openshift/{###}/app-root/repo/newrelic/newrelic.jar"
  </code></pre>
  
  <p>also tried</p>
  
  <pre><code>export JAVA_OPTS="-Xmx384m $JAVA_OPTS"
  </code></pre>
  
  <p>Please guide so that my custom xmx argument is only read instead of default.</p>