[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.

Hi Juan, 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? Thx, Laszlo ----- Original Message -----
From: "Juan Hernandez" <jhernand@redhat.com> To: engine-devel@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@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel

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@redhat.com> To: engine-devel@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@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
_______________________________________________ Engine-devel mailing list Engine-devel@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.

----- Original Message -----
From: "Juan Hernandez" <jhernand@redhat.com> To: "Laszlo Hornyak" <lhornyak@redhat.com> Cc: engine-devel@ovirt.org Sent: Wednesday, September 12, 2012 3:57:33 PM Subject: Re: [Engine-devel] Fixed -Xmx could kill your JVM
<snip>
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 ;-) .
We are talking about virtual memory, allocation of the heap is done as reserved, so there is no real impact on the system if memory is unused. When a reserved page is actually used it is committed. Unless there is a system with small page file, there is no real reason to use lower values in HEAP_MIN. Alon.

On Wednesday 12 September 2012 06:36 PM, Alon Bar-Lev wrote:
----- Original Message -----
From: "Juan Hernandez" <jhernand@redhat.com> To: "Laszlo Hornyak" <lhornyak@redhat.com> Cc: engine-devel@ovirt.org Sent: Wednesday, September 12, 2012 3:57:33 PM Subject: Re: [Engine-devel] Fixed -Xmx could kill your JVM <snip>
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 ;-) .
We are talking about virtual memory, allocation of the heap is done as reserved, so there is no real impact on the system if memory is unused. When a reserved page is actually used it is committed.
Unless there is a system with small page file, there is no real reason to use lower values in HEAP_MIN.
Alon.
I've seen that Java experts from Sun (now Oracle) recommend to identify a good (high enough) value for the heap size and set the same value for both min and max, during the sessions on Java performance in the Java One conference.
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
participants (4)
-
Alon Bar-Lev
-
Juan Hernandez
-
Laszlo Hornyak
-
Shireesh Anjal