Collectors: G1, ZGC, Parallel
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
pick a collector for a latency or throughput goal.
Planned topics
- Parallel GC: maximizes throughput with stop-the-world pauses; good for batch jobs.
- G1: region-based, targets a pause goal (
-XX:MaxGCPauseMillis); the default in modern JDKs; a sound general choice. - ZGC: concurrent, very short pauses even on large heaps; trades some throughput and memory; generational mode in newer JDKs (verify version before recording).
- Choose from a requirement (p99 latency, throughput), then measure.
- Do not switch collectors without a baseline.
Draft outline details
Demonstration
| Goal | Start with |
|---|---|
| Batch throughput | Parallel |
| Typical web API | G1 |
| Strict latency, big heap | ZGC |
Check your understanding
Which collector for a nightly import with no latency target?
Show answer
Parallel.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.