René's URL Explorer Experiment


Title: Garbage Collection in Java: Java GC — Unbounded Cache Full

Open Graph Title: Garbage Collection in Java: Java GC — Unbounded Cache Full

Description: G1 Full GC from unbounded cache spikes p99 latency to 30s+ and kills Kubernetes pods. Doubling heap fails— learn why only a bounded eviction fixes it.

Open Graph Description: G1 Full GC from unbounded cache spikes p99 latency to 30s+ and kills Kubernetes pods. Doubling heap fails— learn why only a bounded eviction fixes it.

Opengraph URL: https://thecodeforge.io/java/garbage-collection-java/

direct link

Domain: thecodeforge.io


Hey, it has json ld scripts:
{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://thecodeforge.io/java/garbage-collection-java/"
  },
  "headline": "Java GC — Unbounded Cache Full GC Spiral",
  "description": "G1 Full GC from unbounded cache spikes p99 latency to 30s+ and kills Kubernetes pods. Doubling heap fails— learn why only a bounded eviction fixes it.",
  "keywords": "Java GC — Unbounded Cache Full GC Spiral, Java, Advanced, Advanced Java, G1 Full GC from unbounded cache spikes p99 latency to 30s+ and kills Kubernetes pods. Doubling heap fails— learn why only a bounded eviction fixes it.",
  "proficiencyLevel": "Expert",
  "author": {
    "@type": "Person",
    "@id": "https://thecodeforge.io/about/#naren",
    "name": "Naren",
    "url": "https://thecodeforge.io/about/"
  },
  "publisher": {
    "@type": "Organization",
    "@id": "https://thecodeforge.io/#org",
    "name": "TheCodeForge",
    "url": "https://thecodeforge.io",
    "logo": {"@type": "ImageObject", "url": "https://thecodeforge.io/assets/og-image.png"}
  },
  "datePublished": "2026-03-05T00:00:00+00:00",
  "dateModified": "2026-08-30T00:00:00+00:00",
  "url": "https://thecodeforge.io/java/garbage-collection-java/",
  "inLanguage": "en",
  "educationalLevel": "Advanced",
  "image": "https://thecodeforge.io/assets/og-image.png",
  "isPartOf": {"@id": "https://thecodeforge.io/#website"}
}
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {"@type": "ListItem", "position": 1, "name": "Home", "item": "https://thecodeforge.io/"},
    {"@type": "ListItem", "position": 2, "name": "Java", "item": "https://thecodeforge.io/java/"},
    {"@type": "ListItem", "position": 3, "name": "Java GC — Unbounded Cache Full GC Spiral", "item": "https://thecodeforge.io/java/garbage-collection-java/"}
  ]
}
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What is the difference between a young GC and a full GC?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Young GC collects only the young generation (eden and survivor) and is fast because most objects die young. Full GC collects the entire heap, compacting all regions, and can take seconds or tens of seconds. Full GC should be a rare event in a well-tuned service."
      }
    },
    {
      "@type": "Question",
      "name": "How do I enable GC logging for a running JVM without restarting?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Use `jcmd  VM.log output=gc.log what=gc*` (JDK 10+). For JDK 8/9, you need to restart with `-Xloggc:` or use `-XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:+PrintGCDetails -XX:+PrintGCDateStamps`. For persistent change, add the flag to the JVM startup command."
      }
    },
    {
      "@type": "Question",
      "name": "What is the recommended heap size for a containerized Java application?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Set -XX:MaxRAMPercentage=75.0 (or -XX:MaxRAMFraction=1) so the JVM uses 75% of container memory for heap. The remaining 25% is for native memory (threads, metaspace, GC overhead). Never set -Xmx equal to container memory limit."
      }
    },
    {
      "@type": "Question",
      "name": "Why does my application run out of memory even though the heap is not full?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Check native memory: metaspace, thread stacks, direct byte buffers, code cache, GC structures. Use `-XX:NativeMemoryTracking=detail` and `jcmd  VM.native_memory summary`. Metaspace leaks from class loader re-deployment are a common cause."
      }
    }
  ]
}

og:typewebsite
og:imagehttps://thecodeforge.io/assets/og-image.png
og:image:width1200
og:image:height630

Links:

TheCodeForge https://thecodeforge.io/
Javahttps://thecodeforge.io/java/
Buy me a coffee https://ko-fi.com/thecodeforge
1Generics in Javahttps://thecodeforge.io/java/generics-java/
2Reflection API in Javahttps://thecodeforge.io/java/reflection-api-java/
3Annotations in Javahttps://thecodeforge.io/java/annotations-java/
4Enums in Javahttps://thecodeforge.io/java/enums-java/
5Inner Classes in Javahttps://thecodeforge.io/java/inner-classes-java/
6Anonymous Classes in Javahttps://thecodeforge.io/java/anonymous-classes-java/
7Design Patterns in Javahttps://thecodeforge.io/java/design-patterns-java/
8Singleton Pattern in Javahttps://thecodeforge.io/java/singleton-pattern-java/
9Factory Pattern in Javahttps://thecodeforge.io/java/factory-pattern-java/
10Builder Pattern in Javahttps://thecodeforge.io/java/builder-pattern-java/
11Garbage Collection in Javahttps://thecodeforge.io/java/garbage-collection-java/
12JVM Memory Modelhttps://thecodeforge.io/java/jvm-memory-model/
13JVM Memory Issues in Production: Debugging Guide (OOM, GC, Leaks)https://thecodeforge.io/java/jvm-memory-debugging/
14JVM GC Tuning Guide: G1, ZGC, Shenandoah Explained with Real Trade-offshttps://thecodeforge.io/java/jvm-gc-tuning/
15Observer Pattern in Javahttps://thecodeforge.io/java/observer-pattern-java/
16Strategy Pattern in Javahttps://thecodeforge.io/java/strategy-pattern-java/
17Decorator Pattern in Javahttps://thecodeforge.io/java/decorator-pattern-java/
18Dependency Injection in Javahttps://thecodeforge.io/java/dependency-injection-java/
19Java Modules — JPMShttps://thecodeforge.io/java/java-modules-jpms/
20Java Memory Leaks and Preventionhttps://thecodeforge.io/java/java-memory-leaks-prevention/
21Spring Boot Introductionhttps://thecodeforge.io/java/spring-boot-introduction/
22Maven vs Gradle in Javahttps://thecodeforge.io/java/maven-vs-gradle-java/
23Java Profiling and Performancehttps://thecodeforge.io/java/java-profiling-performance/
24Java Logging with SLF4J and Logbackhttps://thecodeforge.io/java/java-logging-slf4j-logback/
25Java Agent and Instrumentationhttps://thecodeforge.io/java/java-agent-instrumentation/
26JUnit 5 Annotations: @Test, @BeforeEach, @AfterEach and Morehttps://thecodeforge.io/java/junit5-annotations/
27Mockito verify(): How to Assert Method Calls in Unit Testshttps://thecodeforge.io/java/mockito-verify/
28Unit Testing vs Integration Testing: Key Differenceshttps://thecodeforge.io/java/unit-test-vs-integration-test/
29SLF4J StaticLoggerBinder Warning Fixhttps://thecodeforge.io/java/slf4j-staticloggerbinder/
← Back to Java track https://thecodeforge.io/java/
Homehttps://thecodeforge.io/
Javahttps://thecodeforge.io/java/
Follow https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
 ● Production Incidenthttps://thecodeforge.io/java/garbage-collection-java/#v2-production-incident
 🔎 Debug Guidehttps://thecodeforge.io/java/garbage-collection-java/#v2-debug-guide
 ⚙ Triage Commandshttps://thecodeforge.io/java/garbage-collection-java/#v2-triage-commands
memory managementhttps://thecodeforge.io/cs-fundamentals/memory-management-os/
Pythonhttps://thecodeforge.io/interview/top-python-interview-questions/
designhttps://thecodeforge.io/java/design-patterns-java/
pointershttps://thecodeforge.io/c-cpp/pointers-c/
strategyhttps://thecodeforge.io/java/strategy-pattern-java/
→JVM Memory ModelUnderstand the heap regions these flags operate onhttps://thecodeforge.io/java/jvm-memory-model/
→JVM GC Tuning Guide: G1, ZGC, Shenandoah Explained with Real Trade-offsProduction flag selection and GC algorithm trade-offshttps://thecodeforge.io/java/jvm-gc-tuning/
containerhttps://thecodeforge.io/dsa/container-with-most-water/
HashMaphttps://thecodeforge.io/java/hashmap-java/
arrayshttps://thecodeforge.io/java/arrays-java/
stackhttps://thecodeforge.io/dsa/stack-data-structure/
abstractionhttps://thecodeforge.io/java/abstraction-java/
→JVM Memory Model — OOMKilled by Non-Heap OverheadJVM's -Xmx4g in 4GB container leaves zero headroom; non-heap overhead ~490 MB triggers OOMKilled. Avoid silent crashes whttps://thecodeforge.io/java/jvm-memory-model/
→JVM GC Tuning — G1 Humongous Allocation StormPayment p99 latency spike from 45ms to 12s from G1 humongous objects (3-5MB protobuf). Debugging workflow and trade-offshttps://thecodeforge.io/java/jvm-gc-tuning/
→Stack vs Heap Memory — GC Failed to Reclaim Payment CacheOutOfMemoryError after 2 hours: full GC every 30s failing to reclaim heap. Unbounded ConcurrentHashMap cache prevented Ghttps://thecodeforge.io/dsa/stack-vs-heap-memory/
→G1 GC Concurrent Mode Failure — Fix 20s STW PauseAt 8k req/min, G1 GC's default IHOP=45 triggered Concurrent Mode Failure, causing 20-second pauses and 503 errors. Diagnhttps://thecodeforge.io/java/java-profiling-performance/
→Java ThreadLocal Leak — Missing remove() Cost 2.8GB HeapPayment service OOM at Black Friday: heap grew 180MB/hr, 1.1GB→2.8GB old gen. 4 threads @ 800MB—missing remove(). Fix wihttps://thecodeforge.io/java/java-memory-leaks-prevention/
Priority Scheduling and AgingIntermediatehttps://thecodeforge.io/dsa/priority-scheduling-algorithm/
Follow https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
←PreviousBuilder Pattern in Javahttps://thecodeforge.io/java/builder-pattern-java/
NextJVM Memory Model→https://thecodeforge.io/java/jvm-memory-model/
LinkedIn https://www.linkedin.com/in/thecodeforge-io-a0676b3b5/
Facebook https://www.facebook.com/profile.php?id=61583020033815
YouTube https://www.youtube.com/channel/UCMar7CF2EmCF1I2tw1tNVuQ
Javahttps://thecodeforge.io/java/
Pythonhttps://thecodeforge.io/python/
C / C++https://thecodeforge.io/c-cpp/
JavaScripthttps://thecodeforge.io/javascript/
DSAhttps://thecodeforge.io/dsa/
Databasehttps://thecodeforge.io/database/
System Designhttps://thecodeforge.io/system-design/
DevOpshttps://thecodeforge.io/devops/
C# / .NEThttps://thecodeforge.io/csharp/
PHPhttps://thecodeforge.io/php/
ML / AIhttps://thecodeforge.io/ml-ai/
Interviewhttps://thecodeforge.io/interview/
CS Fundamentalshttps://thecodeforge.io/cs-fundamentals/
Rusthttps://thecodeforge.io/rust/
Toolshttps://thecodeforge.io/tools/
Cheatsheetshttps://thecodeforge.io/cheatsheets/
Mobilehttps://thecodeforge.io/mobile/
Data Analyticshttps://thecodeforge.io/data-analytics/
Securityhttps://thecodeforge.io/security/
Frontendhttps://thecodeforge.io/frontend/
Data Engineeringhttps://thecodeforge.io/data-engineering/
Testinghttps://thecodeforge.io/testing/
Cloudhttps://thecodeforge.io/cloud/
Observabilityhttps://thecodeforge.io/observability/
Web Platformhttps://thecodeforge.io/web-platform/
🧯 Errors Explainedhttps://thecodeforge.io/errors/
⚒ Blueprintshttps://thecodeforge.io/blueprints/
⌨ Practicehttps://thecodeforge.io/practice/
Interview Prephttps://thecodeforge.io/interview/
DSA Problemshttps://thecodeforge.io/dsa/
Developer Toolshttps://thecodeforge.io/tools/
Cheat Sheetshttps://thecodeforge.io/cheatsheets/
Abouthttps://thecodeforge.io/about/
Sitemaphttps://thecodeforge.io/sitemap.xml
Privacyhttps://thecodeforge.io/privacy.html

Viewport: width=device-width, initial-scale=1.0

Robots: max-image-preview:large


URLs of crawlers that visited me.