liveBook · Manning

Memory pressure

As explained in Troubleshooting Java, Second Edition

Memory pressure is a condition in which available runtime memory is insufficient relative to an application's allocation and retention demands.

Memory pressure occurs when an application’s allocation and retention demands strain available runtime memory. It often appears as degraded performance, latency spikes, frequent garbage collection, and increasingly long pauses. section 11.4.1

[2024-02-01T12:00:01.123+0000] GC(45) 
  ➥ Pause Young (G1 Evacuation Pause) 0.025s
[2024-02-01T12:00:02.456+0000] GC(46) 
  ➥ Pause Young (G1 Evacuation Pause) 0.027s
[2024-02-01T12:00:05.789+0000] GC(47) 
  ➥ Pause Young (G1 Evacuation Pause) 0.026s
[2024-02-01T12:00:10.012+0000] 
  ➥ GC(48) Pause Young (G1 Evacuation Pause) 0.110s
[2024-02-01T12:00:20.345+0000] 
  ➥ GC(49) Pause Young (G1 Evacuation Pause) 0.250s
[2024-02-01T12:00:35.678+0000] 
  ➥ GC(50) Pause Full (System.gc()) 2.567s
[2024-02-01T12:00:50.901+0000] 
  ➥ GC(51) Pause Young (G1 Evacuation Pause) 0.180s
[2024-02-01T12:01:10.234+0000] 
  ➥ GC(52) Pause Full (Allocation Failure) 5.321s

Inspect GC events as a sequence: pauses near 25 milliseconds remain ordinary, then pauses rise to 110 and 250 milliseconds before full GCs reach several seconds. section 11.4.1

Investigate memory pressure by checking:

  • Whether high pause times recur across many log entries rather than appearing as isolated exceptions. section 11.4.1
  • Whether frequent full GCs reclaim little memory, suggesting a memory leak, or reclaim memory effectively, suggesting an under-provisioned heap. section 11.5
  • Whether heap sizing, generation sizing, object creation, or garbage collector selection should change. section 11.4.1

How Troubleshooting Java, Second Edition covers it

How deep it goes
Explains pause thresholds, recurring-event checks, heap regions, and likely causes, but stops short of detailed leak analysis.
Examples
Uses G1GC logs progressing from 25-millisecond young pauses to full GCs lasting 2.567 and 5.321 seconds.
What it assumes
Assumes basic JVM and garbage-collection terminology while defining log structure, pause behavior, and heap regions.
What you can do after
Diagnose/debug with GC logs by distinguishing isolated pauses from recurring pressure and selecting targeted tuning steps.
How it connects
Connects garbage collection with GC logs, heap memory, memory leaks, latency, and JVM tuning.

Also explained in

Compare how 2 books explain memory pressure →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.