puppetlabs-puppetdb icon indicating copy to clipboard operation
puppetlabs-puppetdb copied to clipboard

Unable to set multiple -XX JVM options

Open xorpaul opened this issue 12 years ago • 1 comments

I want to be able to set the following JVM options:

-XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution

When I tried using

$java_args = {'-Xmx' => '11g', '-Xmn' => '2g', '-XX:TargetSurvivorRatio' => '=90', '-XX:' => '+PrintGCDateStamps', '-XX:' => '+PrintGCDetails', '-XX:' => '+PrintTenuringDistribution' }
class { 'puppetdb::server':
  java_args => $java_args,
}

I got some settings multiple times:

$ grep ARGS /etc/default/puppetdb
JAVA_ARGS="-Xmx11g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/puppetdb/puppetdb-oom.hprof -XX:TargetSurvivorRatio=90 -Xmn2g"
# puppetd -t
[...]
notice: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:']/value: value changed '+HeapDumpOnOutOfMemoryError' to '+PrintGCDetails'
info: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:']: Scheduling refresh of Service[puppetdb]
notice: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:TargetSurvivorRatio']/ensure: created
info: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:TargetSurvivorRatio']: Scheduling refresh of Service[puppetdb]
[...]
$ grep ARGS /etc/default/puppetdb
JAVA_ARGS="-Xmx11g -XX:+PrintGCDetails -XX:+PrintGCDetails -XX:+PrintGCDetails -Xmn2g -XX:TargetSurvivorRatio=90"

Doing another puppet run with the same settings results in:

# puppetd -t
[...]
notice: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:']/value: value changed '+PrintGCDetails' to '+PrintGCDateStamps'
info: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:']: Scheduling refresh of Service[puppetdb]
notice: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:TargetSurvivorRatio']/ensure: created
info: /Stage[main]/Puppetdb::Server/Ini_subsetting['-XX:TargetSurvivorRatio']: Scheduling refresh of Service[puppetdb]
[...]
$ grep ARGS /etc/default/puppetdb
JAVA_ARGS="-Xmx11g -XX:+PrintGCDateStamps -XX:+PrintGCDateStamps -XX:+PrintGCDateStamps -Xmn2g -XX:+PrintGCDateStamps -XX:TargetSurvivorRatio=90"

For some extra points: I also want to set a GC logfile like so:

'-Xloggc:' => '/var/tmp/puppetdb-gc-`date +\'%Y-%m-%d-%H_%M\'`.log'

At this moment I would feel better with having a simple $java_args_string parameter that simply sets the JAVA_ARGS in /etc/default/puppetdb, because people who tune these settings normally know what they are doing (or should).

xorpaul avatar Nov 20 '13 11:11 xorpaul

Would something like this work?

$java_args = {
  '-Xmx' => '11g',
  '-Xmn' => '2g',
  '-XX:TargetSurvivorRatio' => '=90',
  '-XX:+PrintGCDateStamps' => '',
  '-XX:+PrintGCDetails' => '',
  '-XX:+PrintTenuringDistribution' => '',
}

class { 'puppetdb::server':
  java_args => $java_args,
}

h0tw1r3 avatar May 01 '24 05:05 h0tw1r3