[Engine-devel] Fixed -Xmx could kill your JVM

Juan Hernandez jhernand at redhat.com
Wed Sep 12 12:57:33 UTC 2012


On 09/12/2012 02:44 PM, Laszlo Hornyak wrote:
> Just wondering why the initial memory size for the JVM. Isn't it better if we just start from the default and let it grow to a maximum size?

The reason for setting the min ad max values equal by default is that in
that way the JVM doesn't have to resize the heap during execution, which
takes some additional time (barely noticeable) and can fail if some
other program takes the virtual address space after starting the JVM.

In my experience you get slightly better performance and less problems
if you determine the right size for your environment and then set the
min and max to those values, but I don't really have hard data to
confirm it is good for the engine.

Worst case we can change the defaults for ENGINE_HEAP_MIN and
ENGINE_HEAP_MAX to get that behavior, for example:

ENGINE_HEAP_MIN=128m
ENGINE_HEAP_MAX=1g

I am open to do that change, specially if you show me hard data proving
that it is better for performance ;-) .

> ----- Original Message -----
>> From: "Juan Hernandez" <jhernand at redhat.com>
>> To: engine-devel at ovirt.org
>> Sent: Wednesday, September 12, 2012 2:32:28 PM
>> Subject: [Engine-devel] Fixed -Xmx could kill your JVM
>>
>> Hello,
>>
>> I recently discovered that I made a mistake in the engine service
>> script. The problem is that were running the JVM with the "-Xms
>> option
>> twice, like this:
>>
>>   java -Xms1g -Xms1g ...
>>
>> That doesn't correctly limit the max amount of heap space. It has
>> been
>> fixed in a recent commit [1], so with the updated code the engine
>> will
>> run by default like this:
>>
>>   java -Xms1g -Xmx1g ...
>>
>> With this change you could start to see OutOfMemory errors if your
>> engine was using a lot of memory, if you are running stress tests,
>> for
>> example. In that case remember that you can adjust this changing the
>> ENGINE_HEAP_MIN and ENGINE_HEAP_MAX parameters in
>> /etc/sysconfig/ovirt-engine. For example, to use 2g instead of the
>> default of 1g:
>>
>> ENGINE_HEAP_MIN=2g
>> ENGINE_HEAP_MAX=2g
>>
>> The restart the engine.
>>
>> Let me know if you have issues.
>>
>> Regards,
>> Juan Hernandez
>>
>> [1] http://gerrit.ovirt.org/7952
>>
>> --
>> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
>> 3ºD, 28016 Madrid, Spain
>> Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat
>> S.L.
>> _______________________________________________
>> Engine-devel mailing list
>> Engine-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/engine-devel
>>
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 


-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.



More information about the Engine-devel mailing list