Puppet Function: pupmod::java_max_memory
- Defined in:
- functions/java_max_memory.pp
- Function type:
- Puppet Language
Overview
Provides a reasonable calculation for the reserved code cache value for JRuby for a system
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'functions/java_max_memory.pp', line 9
function pupmod::java_max_memory (
Integer[1] $max_active_instances = 1,
) {
$processor_count = pick(fact('processors.count'), 1)
$total_system_memory = Numeric(fact('memorysize_mb'))
if $processor_count < 8 {
$per_instance_mem = 512
} elsif $processor_count < 16 {
$per_instance_mem = 768
} else {
$per_instance_mem = 1024
}
if $total_system_memory < 1024 {
$java_max_memory = '50%'
} else {
$max_instances_mem_mb = $max_active_instances * $per_instance_mem
$eighty_percent_mem_mb = floor($total_system_memory * 0.8)
$java_mem_mb = min($eighty_percent_mem_mb, $max_instances_mem_mb)
$java_max_memory = "${java_mem_mb}m"
}
$java_max_memory
}
|