[ODLPARENT-175] add -XX:+DisableExplicitGC to ODL Karaf JVM options to prevent explicit System.gc() Created: 12/Nov/18  Updated: 27/Dec/18  Resolved: 27/Dec/18

Status: Resolved
Project: odlparent
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.5, 4.0.3

Type: Bug Priority: Medium
Reporter: Michael Vorburger Assignee: Stephen Kitt
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I'm looking at a Java Flight Recording obtained from (internal) scale lab testing, and see:

23.5 % of the garbage collections were caused by System.gc(). Calling System.gc() might not be optimal, since it can cause an unnecessary amount of garbage collections. The garbage collectors usually handles this fine by themselves without being explicitly called.

To fix this, remove unnecessary System.gc() calls in the code. If the calls are made by libraries where you can't change the source code, you can instead use the command line flag '-XX:+DisableExplicitGC'. This flag makes the JVM ignore all System.gc() calls.

Searching for System.gc() in ODL code shows a few places where we do this, but most are in tests, or in old projects like nic and vtn; one is in netvirt.

This issue proposes that we add -XX:+DisableExplicitGC to ODL Karaf JVM options to prevent explicit System.gc() - I don't see the disadvantage, so better safe than sorry, and prevent future problems.



 Comments   
Comment by Michael Vorburger [ 12/Nov/18 ]

> one is in netvirt

strike that, I meant https://github.com/opendaylight/vpnservice/blob/master/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/bgpmanager/oam/BgpCounters.java but that is in the old vpnservice, in netvirt this has already been removed.

Curious then - unclear what is actually doing this (in our scale tests) - must be something from a library?!

Comment by Stephen Kitt [ 13/Nov/18 ]

Given

If the calls are made by libraries where you can't change the source code, you can instead use the command line flag '-XX:+DisableExplicitGC'. This flag makes the JVM ignore all System.gc() calls.

I thought that “must be something from a library” was the original reason you were asking for this!

Comment by Michael Vorburger [ 13/Nov/18 ]

Merged c/77708, but suggest we clarify Fix Version of this, actually rolling to projects (Neon? Fluorine? Oxygen?) and d/s.

Generated at Wed Feb 07 20:27:50 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.