Skip to content

Instantly share code, notes, and snippets.

@seansu4you87
Last active August 29, 2015 14:05
Show Gist options
  • Save seansu4you87/960ccb6e7af7be8f9246 to your computer and use it in GitHub Desktop.
Save seansu4you87/960ccb6e7af7be8f9246 to your computer and use it in GitHub Desktop.
GC Notes

Three Variables for GC

  1. Throughput: The amount of work done by an application as a ratio of time spent in GC.
‑XX:GCTimeRatio=99

means 99% of time spent on application computation, 1% spent in GC

  1. Latency: The time taken by systems in responding to events which is impacted by pauses introduced by GC. Target latency with the flag
‑XX:MaxGCPauseMillis=<n>
  1. Memory: The amount of memory used to store state. Maximum heap size is set via the flag
–Xmx<n>

Generations

(Eden -> Survivor) -> Tenured -> Perm (deprecated)

TLAB: Thread Local Allocation Buffer (mechanism through which threads request memory). When a TLAB is filled, a thread requests a new one from Eden.

When Eden is filled, a minor collection commences. During minor collection, all live objects are copied over to a Survivor space or promoted to Tenured space.

Helpful Flags

‑XX:+PrintGCApplicationStoppedTime: Prints out the time needed to bring all threads to a safe point for Stop-The-World event

– XX:MaxTenuringThreshold: Threshold for collections survived before being promoted to Tenured

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment