We currently default the 'max-active-instances' for JRuby to (num-cpus) + 2. This has proven to be problematic in cases where users install Puppet Server on a machine with a very large number of cores, because the volume of JRuby instances requires a huge amount of RAM. Since we default to a max heap size of 2GB, there is a strong likelihood of an OutOfMemoryError.
If we instead err on the side of setting the number of JRuby instances too low, then the user might experience performance issues and need to manually tune the number of JRuby instances higher, but that seems preferable to erring on the side of tuning the number of instances too high and having the service crash.
Furthermore, if we add some additional metrics to the system we can detect if there is more load than we can handle with the configured number of JRuby instances, and log informative messages suggesting that the user increase the number of JRubies.
With all of this in mind, it seems like the best option would be to default to a static value like 4 or 6. However, those settings might be too high for demo/test systems that only have one or two cores.
Perhaps the default could be something like `min(num-cpus, 6)`?