1

I've an application that's using an off-heap byte array to read data from and pushes it into a primitive (key and value) heap based Hashmap. I've allocated 4G to my application, running it for 10 minutes show 14MB of max heap usage, but within that 10 minutes I see a few young collections kicking in. These collections are running for handful of regions (6 - 8) only. I profiled it to see how much garbage my application is generating but it's less than 40MB in 10 minutes.

Is there a way, I can tell G1GC to not to kick young GC, because there is plenty of heap left. Probably, collect it lets say after 1GB or 50% of young generation usage, which I know my application would never hit? I tried the following:

  1. Increasing XX:G1NewSizePercent to 50% and it did make a difference but not enough. So instead of 10 collection I'm getting 5. But still 5 is too much in my case.
  2. Reducing pause time to 1ms.-XX:MaxGCPauseMillis
  3. Increasing concurrent thread to same number as my cores via XX:ConcGCThreads.

Example of GC logs:

101.211: [GC pause (G1 Evacuation Pause) (young) 101.211: [G1Ergonomics (CSet Construction) start choosing CSet, _pending_cards: 1030, predicted base time: 3.04 ms, remaining time: 46.96 ms, target pause time: 50.00 ms] 101.211: [G1Ergonomics (CSet Construction) add young regions to CSet, eden: 3 regions, survivors: 1 regions, predicted young region time: 1.03 ms] 101.211: [G1Ergonomics (CSet Construction) finish choosing CSet, eden: 3 regions, survivors: 1 regions, old: 0 regions, predicted pause time: 4.07 ms, target pause time: 50.00 ms] , 0.0010747 secs] [Parallel Time: 0.6 ms, GC Workers: 8] [GC Worker Start (ms): Min: 101210.9, Avg: 101211.0, Max: 101211.1, Diff: 0.1] [Ext Root Scanning (ms): Min: 0.2, Avg: 0.2, Max: 0.3, Diff: 0.2, Sum: 1.7] [Update RS (ms): Min: 0.0, Avg: 0.0, Max: 0.1, Diff: 0.1, Sum: 0.3] [Processed Buffers: Min: 0, Avg: 1.0, Max: 2, Diff: 2, Sum: 8] [Scan RS (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0] [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.2, Diff: 0.2, Sum: 0.2] [Object Copy (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.6] [Termination (ms): Min: 0.0, Avg: 0.1, Max: 0.1, Diff: 0.1, Sum: 0.7] [Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 8] [GC Worker Other (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1] [GC Worker Total (ms): Min: 0.4, Avg: 0.4, Max: 0.5, Diff: 0.1, Sum: 3.5] [GC Worker End (ms): Min: 101211.4, Avg: 101211.5, Max: 101211.5, Diff: 0.0]

Abidi
  • 7,846
  • 14
  • 43
  • 65
  • Would running without the GC do? – Scratte Jan 26 '20 at 23:10
  • @scratte Do you mean by running Epsilon No-Op GC instead? Ideally, I would like a zero GC or delay it for as long as I can. How can I do without GC? – Abidi Jan 27 '20 at 18:22
  • Yes, that's what I was thinking. I only mentioned it because you wrote "which I know my application would never hit". – Scratte Jan 27 '20 at 18:48
  • 1) Why are saying anything about off-heap here, how is that relevant to what a GC does? 2) if you increased the percentage of new size _and_ you want it to stay that way: disable adaptive policy also 3) young collection happens in full stop the world mode, so setting `ConcGCThreads` is useless for young collections. – Eugene Jan 31 '20 at 04:18
  • I was trying to make a point that, I'm doing everything off heap and GC usage is very less. Why is young generation kicking off when there is a lot of young space left. When you say disable-adaptive-policy, how do I do that? – Abidi Feb 02 '20 at 08:56
  • you have to tag me with `@` so that I know you followed-up, otherwise I have no idea you commented. Can you share the entire logs may be? I am a bit un-clear where you see that you have more space. – Eugene Mar 08 '20 at 04:55

0 Answers0