Bug 850723 - standalone.conf of jbossas-7/jbosseap-6 does not read node_profile from '/etc/stickshift/resource_limits.conf' at all
standalone.conf of jbossas-7/jbosseap-6 does not read node_profile from '/etc...
Status: CLOSED NOTABUG
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
1.x
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Bill DeCoste
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-22 04:49 EDT by Nick Tan
Modified: 2012-08-25 10:53 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-25 10:53:26 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nick Tan 2012-08-22 04:49:23 EDT
Description of problem:
I created a jboss app on OpenShift Origin, but found that not able to change the jboss JVM settings, since the standalone.conf of jbossas-7/jbosseap-6 does not read node_profile from '/etc/stickshift/resource_limits.conf' at all


Steps to Reproduce:
1. create any one simple jboss app on OpenShift Origin, 
2. start the app, you can see the JVM setting are of 'small' node_profile.
3. then try to modify the node_profile to medium in /etc/stickshift/resource_limits.conf, 
4. restart the jboss app, we will see the JVM setting not change


Additional info:
the original code snippet for reading the node_profile in standalone.conf was:
  resource_limits_file=`readlink -f /etc/stickshift/resource_limits.conf`
  resource_limits_file_name=`basename $resource_limits_file`
  node_profile=`echo ${resource_limits_file_name/*./}`

my workaround are here two options:
### option1:
source $resource_limits_file

### option2:
node_profile=`sed '/^\#/d' /etc/stickshift/resource_limits.conf | grep 'node_profile'  | tail -n 1 | cut -d "=" -f2-`
# set node_profile as 'small' by default, if it not set
if test "x$node_profile" = "x"
then
    node_profile=small
fi
echo "node_profile=$node_profile"
Comment 1 Bill DeCoste 2012-08-23 16:48:16 EDT
What JVM settings are you trying to add/modify?
Comment 2 Bill DeCoste 2012-08-23 18:14:15 EDT
Below are the settings for the small and medium gears. These settings are correct. Are there additional VM settings you need to add?

For small gears:
VM Arguments: -D[Standalone] -Xmx256m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -Dorg.jboss.r
esolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=small-judcon.rhcloud.com -Djgroups.bind_addr=127.
10.158.1 -Dorg.jboss.boot.log.file=/var/lib/stickshift/b3c30b333ebd4c07abc7d8e4222e505a/small/jbossas-7/standalone/log/boot.log -Dlogging.configuration=file:/var/lib/stickshi
ft/b3c30b333ebd4c07abc7d8e4222e505a/small/jbossas-7/standalone/configuration/logging.properties

For medium gears:
VM Arguments: -D[Standalone] -Xmx664m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -Dorg.jboss.r
esolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=medium-judcon.rhcloud.com -Djgroups.bind_addr=127
.12.127.1 -Dorg.jboss.boot.log.file=/var/lib/stickshift/6c822f1f97b041de972fb19d769b2e45/medium/jbossas-7/standalone/log/boot.log -Dlogging.configuration=file:/var/lib/sticks
hift/6c822f1f97b041de972fb19d769b2e45/medium/jbossas-7/standalone/configuration/logging.properties
Comment 3 Nick Tan 2012-08-23 22:29:08 EDT
hi, Bill

i'm not suck at the JVM settings, my point is i would like to switch between 'small', 'medium', 'large' JVM settings.
from my understanding, by modifying the 'node_profile' in /etc/stickshift/resource_limits.conf can make the tricky (according what I read from the source code), but the problem is no matter what value for 'node_profile' i changed, the 'small' JVM setting was always used, that means the standalone.conf does not read 'node_profile' correctly
so I provided two options to read the 'node_profile' from resource_limits.conf
Comment 4 Bill DeCoste 2012-08-23 22:47:08 EDT
Hi Nick,

OK, I think I see the problem. standalone.conf picks up the value from the link not from the contents of the linked file. If you want to modify the default behavior you should modify the link, not the content of the file (see below). 

I assume you are running OpenShift locally? Either built from source or via LiveCD?

resource_limits_file=`readlink -f /etc/stickshift/resource_limits.conf`
resource_limits_file_name=`basename $resource_limits_file`
node_profile=`echo ${resource_limits_file_name/*./}`
case "$node_profile" in
    micro)
        memory_options="-client -Xmx100m -XX:MaxPermSize=100m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true"
    ;;
    small)
        memory_options="-client -Xmx256m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true"
    ;;
    medium)
        memory_options="-client -Xmx664m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true"
    ;;
    large)
        memory_options="-Xmx1456m -XX:MaxPermSize=148m -XX:+AggressiveOpts"
    ;;
    exlarge)
        memory_options="-Xmx2888m -XX:MaxPermSize=184m -XX:+AggressiveOpts"
    ;;
    jumbo)
        memory_options="-Xmx5888m -XX:MaxPermSize=256m -XX:+AggressiveOpts"
    ;;
esac

Thanks -Bill
Comment 5 Nick Tan 2012-08-24 00:13:56 EDT
hi, Bill

i build openshift origin from source code (multi-nodes)

where is the link file located? thanks
Comment 6 Bill DeCoste 2012-08-24 10:55:27 EDT
/etc/stickshift/resource_limits.conf is a link. It's linked to one the real file /etc/stickshift/resource_limits.conf.small. If you change the link so that /etc/stickshift/resource_limits.conf points to /etc/stickshift/resource_limits.conf.medium then the standalone.conf will use the medium gear profile settings (i.e. memory)
Comment 7 Nick Tan 2012-08-24 12:20:54 EDT
ah, OK, I see, i should 'man readlink' before, on my OpenShift Origin, the resource_limits.conf is a file, will try link later, thanks very much.
Comment 8 Bill DeCoste 2012-08-24 12:27:43 EDT
Please let me know if moving the link works for you so I can close the bug. Thanks
Comment 9 Nick Tan 2012-08-25 00:10:32 EDT
Thanks, Bill

yes, it works now after I created the /etc/stickshift/resource_limits.conf.medium, /etc/stickshift/resource_limits.conf.small, and created link file /etc/stickshift/resource_limits.conf point to /etc/stickshift/resource_limits.conf.medium.

but I'm just wondering why not create these conf profiles and link file by default? (in my case, the resource_limits.conf is a plain file not a link at all)
Comment 10 Bill DeCoste 2012-08-25 10:53:26 EDT
This allows us to create predefined profile settings and easily switch between then for the default gear size. You can also control the JVM settings by using the rhc --gear-size option when you create you application. 

I'm going to close this bug, but please reach out to me at wdecoste@redhat.com on on IRC if you have any other questions.

Note You need to log in before you can comment on or make changes to this bug.