# Tune the performance of the Java garbage collector

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/)
- [Overview](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/purpose_of_gc/)
- [Setup](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/setup/)
- [Types of Garbage Collector](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/different_gcs/)
- [Example Application](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/example_application/)
- [Basic GC Tuning Options](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/tuning-parameters/)
- [Intermediate GC Tuning Options](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/optional_tuning/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/java-gc-tuning/_next-steps/)

## About this Learning Path

|  |  |
| --- | --- |
| Skill level: | Introductory |
| Reading time: | 45 min |
| Last updated: | 16 Sep 2026 |

|  |  |
| --- | --- |
| Author: | Kieran Hejmadi , Arm<br>[GitHub](https://github.com/kieranhejmadi01)<br>[LinkedIn](https://linkedin.com/in/kieran-hejmadi-88920815b) |
| Arm IP: | [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags: | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture) [AWS Graviton](https://learn.arm.com/tag/aws-graviton) [Microsoft Azure Cobalt](https://learn.arm.com/tag/microsoft-azure-cobalt) [Google Axion](https://learn.arm.com/tag/google-axion) [Oracle Cloud Infrastructure (OCI) Ampere Compute](https://learn.arm.com/tag/oracle-cloud-infrastructure-oci-ampere-compute) [Linux](https://learn.arm.com/tag/linux) [Java](https://learn.arm.com/tag/java) [Runbook](https://learn.arm.com/tag/runbook) |

## Who is this for?

This Learning Path is for Java developers aiming to optimize application performance on Arm-based servers, especially those migrating applications from x86-based to Arm-based instances.

## What will you learn?

After completing this Learning Path, you'll be able to perform the following tasks:

- Identify the key differences between individual Java GCs.
- Monitor and interpret GC performance metrics.
- Adjust core parameters to optimize performance for your specific workload.

## Prerequisites

Before starting, you'll need the following prerequisites:

- An Arm-based instance from a cloud service provider, or an on-premise Arm server
- Basic understanding of Java
- An [installation of Java](https://learn.arm.com/install-guides/java/) on your machine

## Summary

You’ll evaluate and tune Java garbage collection on Arm-based servers. First, you’ll verify your JDK and available collectors, run a compact heap-filling program, and compare common production GCs. Then, you’ll also learn how to upgrade to a recent long-term-support (LTS) JDK before adjusting settings. By comparing application behavior across runs on cloud or on-premises Arm-based instances, you’ll connect collector choices and configuration changes to workload needs.

## Frequently asked questions

**How do I set up Java?**

Install Java using the [Arm Java install guide](https://learn.arm.com/install-guides/java/). After installation, run `java --version` to confirm it’s available.

**How do I check my JDK version and decide whether to upgrade?**

Run `java --version` and review the reported release. Use one of the latest LTS JDKs because newer releases include GC improvements, such as G1GC pause time improvements from JDK 8 to JDK 11.

**How can I monitor garbage collection while the Java program runs?**

Run `jstat -gcutil $(pgrep java) 1000` in a second terminal while the example application runs. Review the `YGC`, `YGCT`, `FGC`, `FGCT`, and `GCT` columns to assess young, full, and total GC activity.

**What should I expect when running the example application?**

The program prints a startup message and then rapidly allocates many String objects to fill the heap. This makes GC behavior easier to observe so you can compare runs under different configurations.

**How do I enable GC logging for the example application?**

For JDK 11 and later, run `java -Xms512m -Xmx1024m -XX:+UseSerialGC -Xlog:gc:file=gc.log:tags,uptime,time,level:filecount=10,filesize=16m HeapUsageExample.java`. For JDK 8, use the `-Xloggc:gc.log`, `-XX:+PrintGCTimeStamps`, and `-XX:+UseGCLogFileRotation` options instead. Both commands create a `gc.log` file.
