top | item 41593194

(no title)

lbalazscs | 1 year ago

In 2015 there was no ZGC. Today ZGC (an optional garbage collector optimized for latency) guarantees that there will be no GC pauses longer than a millisecond.

discuss

order

survivedurcode|1 year ago

I would check your answer. These are pauses due to time spent writing to diagnostic outputs. These are not traditional collection pauses. This affects both jstat as well as writes of GC logs. (I.e. GC log writes will block the app just the same way)

pjmlp|1 year ago

Which is why for anything serious one should be using Flight Recorder instead.

esaym|1 year ago

These modern garbage collectors are not simply free though. I got bored last year and went on a deep dive with GC params for Minecraft. For my needs I ended up with: -XX:+UseParallelGC -XX:MaxGCPauseMillis=300 -Xmx2G -Xms768M

When flying around in spectator mode, you'd see 3 to 4 processes using 100%. Changing to more modern collectors just added more load to the system. ZGC was the worst, with 16+ processes all using 100% cpu. With the ParallelGC, yes you'll get the occasional pause but at least my laptop is not burning hot fire.

plandis|1 year ago

Yes no GC is free (well perhaps Epsilon comes close :)

It’s a low pause GC so latencies, particularly tail latencies, can be more predictable and bounded. The tradeoff you make is that it uses more CPU time and memory in order to operate.

mike_hearn|1 year ago

Minecraft really needs generational ZGC (totally brand new) because Minecraft generates garbage at prodigious rates and non-generational GC collects less garbage per unit time.

namibj|1 year ago

You'll need more spare heap for ZGC.

tuna74|1 year ago

Yes, this is why GCs work so bad for 3D games since you are usually limited by memory bandwidth and latency, especially on systems with unified RAM (no seperate GPU RAM).

kanzenryu2|1 year ago

Sadly in many cases no; it's not magic. This nirvana is restricted to cases where there is CPU bandwidth available (e.g. some cores idle) and plenty of free RAM. When either CPU or RAM are less plentiful... hello pauses my old friend.

sunshowers|1 year ago

This is why memory-bound services generally use languages without mandatory GC. Tail latency is a killer.

Rust's memory management does have some issues in practice (large synchronous drops) but they're relatively minor and easily addressed compared to mandatory GC.

hawk_|1 year ago

ZGC doesn't remove safepoint requests on threads which is the root cause. "Guarantees" here are with very heavy quotes.

funcDropShadow|1 year ago

But it reduces the amount of safepoint requests by doing more in parallel to the working application.

hinkley|1 year ago

The cost of statistics gathering on a GC implementation that avoids ineffective GC activity is less affected by the cost of telemetry (no news is good news), but it is still affected.