{"id":32260,"date":"2023-08-03T08:38:07","date_gmt":"2023-08-03T12:38:07","guid":{"rendered":"https:\/\/www.eginnovations.com\/blog\/?p=32260"},"modified":"2024-12-10T05:03:49","modified_gmt":"2024-12-10T10:03:49","slug":"what-is-garbage-collection-java","status":"publish","type":"post","link":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/","title":{"rendered":"A Comprehensive Guide to Garbage Collection in Java"},"content":{"rendered":"<div class=\"inner_content\">\n<h2><span class=\"ez-toc-section\" id=\"Java_Garbage_Collection_Basics\"><\/span>Java Garbage Collection: Basics<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6606 size-full\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg\" alt=\"Excessive Garbage Collection - an image of an overflowing bin to illustrate the problem of excessive GC with Java\" width=\"160\" height=\"130\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg 160w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection-140x114.jpg 140w\" sizes=\"auto, (max-width: 160px) 100vw, 160px\" \/>What is Garbage Collection in Java?. In Java applications, objects are stored in a memory area called the \u201cheap\u201d, which is dedicated to dynamically allocated objects. If left unattended, these objects can accumulate and deplete the available memory in the heap &#8211; eventually leading to an <span style=\"color: #c50000;\">OutOfMemoryError.<\/span><\/p>\n<p>The Java Virtual Machine (JVM) employs an automatic Garbage Collection (GC) mechanism. This mechanism handles the release of memory occupied by unused objects and reallocates that memory space for new objects.<\/p>\n<div style=\"padding: 20px; border: 1px solid #ffd392; background: #fcf8ef; margin-bottom: 30px;\">\n<p style=\"font-size: 21px; margin-bottom: 15px;\"><strong>Common Misunderstanding: Garbage Collection in Java is the automated process of \u201cdeleting code\u201c<\/strong><\/p>\n<p style=\"margin-bottom: 5px;\">Garbage collection in Java is the automated process of reclaiming memory occupied by unused objects, <em>not deleting code.<\/em><\/p>\n<\/div>\n<h4 style=\"font-family: 'Graphik-semibold'; line-height: 34px; font-size: 24px;\"><span class=\"ez-toc-section\" id=\"Get_in-depth_information_on_Java_Garbage_Collection_automated_memory_management_heap_memory_mark-and-sweep_algorithm_JVM_generations_garbage_collectors_and_more\"><\/span>Get in-depth information on Java Garbage Collection: automated memory management, heap memory, mark-and-sweep algorithm, JVM generations, garbage collectors and more.<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The Garbage Collection (GC) feature in the Java Virtual Machine (JVM) is truly remarkable. It automatically identifies and cleans up unused Java objects without burdening developers with manual allocation and deallocation of memory.<\/p>\n<p>As an SRE or Java Administrator you need a strong understanding of the Java Garbage Collection mechanism to ensure optimal performance and stability of your Java applications. If you are looking for a basic general overview on the principles of &#8220;What is Garbage Collection in Programming?&#8221; &#8211; you may like to start, here: <a href=\"https:\/\/www.techtarget.com\/searchstorage\/definition\/garbage-collection#:~:text=Garbage%20collection%20(GC)%20is%20a,longer%20needed%20by%20the%20program.\">What is garbage collection (GC) in programming? (techtarget.com)<\/a>.<\/p>\n<div style=\"padding: 20px; border: 1px solid #ffd392; background: #fcf8ef; margin-bottom: 30px;\">\n<h2><span class=\"ez-toc-section\" id=\"As_an_SRE_you_may_face_these_Java_Garbage_Collection_GC_challenges\"><\/span>As an SRE, you may face these Java Garbage Collection (GC) challenges<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">The complex nature of the GC and and its myriad options can often cause performance issues affecting end user experience due to poor GC tuning:<\/p>\n<ul style=\"margin-bottom: 15px;\">\n<li><strong>Application Pauses:<\/strong> During GC cycles, the application may experience pauses causing the application to hang or lag.<\/li>\n<li><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-32313 size-full\" style=\"width: 200px; margin-bottom: 15px;\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/JVM_Crash.png\" alt=\"An icon representing the JVM (Java Virtual Machine)\" width=\"250\" height=\"221\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/JVM_Crash.png 250w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/JVM_Crash-140x124.png 140w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><strong>Application Crashes:<\/strong> GC may fail to reclaim sufficient memory. This can cause OutOfMemory errors, leading to application crashes.<\/li>\n<li><strong>High CPU Usage:<\/strong> GC can consume a significant amount of CPU resources, impacting application performance. Answering the question: \u201cIs it the application code or the JVM GC?\u201d can be challenging.<\/li>\n<li><strong>Memory Fragmentation:<\/strong> Repeated allocation and deallocation of memory can result in memory fragmentation, slowing down allocation speed and leading to allocation errors.<\/li>\n<\/ul>\n<p style=\"margin-bottom: 15px;\">An <a href=\"https:\/\/www.eginnovations.com\/supported-technologies\/jvm-monitoring\">application monitoring tool<\/a> can detect GC issues and answer the following questions using historical and real-time data:<\/p>\n<ul>\n<li>Is garbage collection taking too long and adversely affecting Java application performance?<\/li>\n<li>How does performance compare across different garbage collection settings?<\/li>\n<li>Are JVM restarts occurring unexpectedly?<\/li>\n<\/ul>\n<p style=\"margin-bottom: 5px;\"><a href=\"https:\/\/www.eginnovations.com\/supported-technologies\/jvm-monitoring\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-19416\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm.jpg\" alt=\"\" width=\"800\" height=\"150\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm.jpg 800w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm-300x56.jpg 300w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm-768x144.jpg 768w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm-310x58.jpg 310w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/monitor-jvm-140x26.jpg 140w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<\/div>\n<p>In this educational post, we will explain what Java Garbage Collection is, why it is important, and how to make it easy for Java SREs and administrators to deal with it. In related posts, we will look at how to get detailed visibility into your Java memory and GC Java performance.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_is_Java_Garbage_Collection_Important\"><\/span>Why is Java Garbage Collection Important?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">Java Garbage Collection is essential for several reasons:<\/p>\n<ol>\n<li><strong>Automation and simplification:<\/strong> Automatic garbage collection in Java takes the burden off developers. In contrast, languages like C or C++ require explicit memory allocation and deallocation, which can be error-prone and lead to crashes if not handled properly.<\/li>\n<li><strong>Increased Developer Productivity:<\/strong> With automatic Java memory management, developers can focus on writing application logic, leading to faster development cycles.<\/li>\n<li><strong>Preventing OutOfMemoryError:<\/strong> By automatically tracking and removing unused objects, garbage collection prevents memory-related errors like OutOfMemoryError errors.<\/li>\n<li><strong>Eliminates dangling pointer bugs:<\/strong> These are bugs that occur when a piece of memory is freed while there are still pointers to it, and one of those pointers is dereferenced. By then the memory may have been reassigned to another use with unpredictable results.<\/li>\n<li><strong>Eliminates Double free bugs:<\/strong> These happen when the program tries to free a region of memory that has already been freed and perhaps already been allocated again.<\/li>\n<\/ol>\n<div style=\"padding: 20px; border: 1px solid #ffd392; background: #fcf8ef; margin-bottom: 30px;\">\n<h2><span class=\"ez-toc-section\" id=\"Java_GC_is_automatic_but_is_not_a_silver_bullet\"><\/span>Java GC is automatic but is not a silver bullet<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol style=\"margin-bottom: 15px;\">\n<li><strong>GC can still impact performance:<\/strong> In spite of its benefits, GC can still impact application speed. As an SRE, you need to select the appropriate garbage collector relative to your application workloads.<\/li>\n<li><strong>GC cannot prevent memory leaks:<\/strong> A memory leak in Java is a situation where unreferenced objects persist in memory, preventing the garbage collector from reclaiming them. This can lead to application slowdowns or crashes.<\/li>\n<\/ol>\n<p><strong>Application Monitoring:<\/strong> Use application monitoring tools to detect and address performance issues promptly. This proactive approach ensures smooth and efficient Java applications.<\/p>\n<p style=\"margin-bottom: 5px;\"><a href=\"https:\/\/www.eginnovations.com\/product\/application-performance-monitoring\/free-trial\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-19662\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Troubleshoot-Java-Application-banner-1.png\" alt=\"\" width=\"800\" height=\"193\" \/><\/a><\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Memory_Heap_Generations_in_Java_Garbage_Collection\"><\/span>Memory Heap Generations in Java Garbage Collection<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">Understanding the memory heap generations is crucial for Java garbage collection efficiency. The generations are:<\/p>\n<ol>\n<li><strong>Eden:<\/strong> Where objects are created; GC removes unused objects or moves them to Survivor space if still referenced.<\/li>\n<li><strong>Survivor:<\/strong> Comprises survivor zero and survivor one spaces in the young generation.<\/li>\n<li><strong>Tenured:<\/strong> Holds long-lived objects; GC checks this less frequently due to its larger size in the old generation.<\/li>\n<\/ol>\n<p>Garbage collection occurs more often in Eden, while Tenured is checked less, optimizing the process. Minor garbage collection takes place in the young generation, while major garbage collection occurs in the old generation and takes longer but happens less frequently. The permanent generation (PermGen) was removed in Java 8.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_does_Garbage_Collection_work_in_Java_Java_Garbage_Collection_explained\"><\/span>How does Garbage Collection work in Java? Java Garbage Collection explained.<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In Java, objects are created dynamically using the \u201cnew\u201d keyword. Once an object is created, it occupies memory space on the heap. As a program executes, objects that are no longer referenced or accessible need to be removed to free up memory and prevent memory leaks. Thus, the Java heap memory contains a collection of live and dead objects &#8211; live objects are still in use and dead objects are no longer needed.<\/p>\n<p>The Garbage Collection in Java operation is based on the premise that most objects used in the Java code are short-lived and can be reclaimed shortly after their creation. As a result of garbage collection in Java, unreferenced objects are automatically removed from the heap memory, which makes Java memory-efficient.<\/p>\n<p style=\"margin-bottom: 15px;\">In general, all Java garbage collectors have two main objectives:<\/p>\n<ol>\n<li>Identify all objects that are still in use or &#8220;alive.&#8221;.<\/li>\n<li>Remove all other objects that are considered dead or unused (i.e., unreachable).<\/li>\n<\/ol>\n<p style=\"margin-bottom: 15px;\">The Java garbage collector performs this task by periodically identifying and reclaiming memory that is no longer in use. The most commonly used Java Garbage Collection algorithm is called the mark-and-sweep algorithm, which follows these steps:<\/p>\n<ul>\n<li><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-32335 size-full\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Java-Garbage-object-img.png\" alt=\"Garbage Collection Java Object Diagram - explaining Java Garbage Collection and the difference between reachable and unreachable objects\" width=\"485\" height=\"422\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Java-Garbage-object-img.png 485w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Java-Garbage-object-img-300x261.png 300w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Java-Garbage-object-img-310x270.png 310w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/Java-Garbage-object-img-140x122.png 140w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><strong>Marking phase:<\/strong> The garbage collector starts with a root set of objects (e.g., global variables, stack frames, and CPU registers) that are known to be in use. It recursively traverses through these objects, marking each object it encounters as &#8220;live&#8221; or reachable. All reachable objects starting from known root references (such as local variables, static variables, and thread stacks) are marked as live objects.<\/li>\n<li><strong>Sweeping phase:<\/strong> The garbage collector scans the entire heap, identifying and reclaiming memory occupied by objects that were not marked during the marking phase. These objects are considered garbage. Any objects that have not been marked as &#8220;live&#8221; during the mark phase are considered unreachable and are marked as eligible for garbage collection. The memory occupied by these unreachable objects is then freed up for future allocations.<\/li>\n<\/ul>\n<div style=\"padding: 20px; border: 1px solid #ffd392; background: #fcf8ef; margin-bottom: 30px;\">\n<h2><span class=\"ez-toc-section\" id=\"When_is_an_Object_eligible_for_Garbage_Collection\"><\/span>When is an Object eligible for Garbage Collection?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul style=\"margin-bottom: 15px;\">\n<li>Every Java program has one or more threads. An object is eligible for garbage collection when no live thread can access it.<\/li>\n<li>If two objects have reference to each other and do not have any live reference then both objects are candidates for being garbage collected.<\/li>\n<li>If a reference of an object is explicitly set to null, the object is available for garbage collection.<\/li>\n<li>An object also becomes eligible for garbage collection if it is created inside a block and the reference goes out of the scope once control of the program exits from this block.<\/li>\n<\/ul>\n<p style=\"margin-bottom: 5px;\">Objects that are actively referenced by live threads are not eligible for garbage collection.<\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Two_types_of_garbage_collection_activity_that_usually_happen_in_Java\"><\/span>Two types of garbage collection activity that usually happen in Java<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>A minor or incremental Java garbage collection<\/strong> is said to have occurred when unreachable objects in the young generation heap memory are removed.<\/li>\n<li><strong>A major or full Java garbage collection<\/strong> is said to have occurred when the objects that survived the minor garbage collection and were then copied into the old generation or permanent generation heap memory are removed. When compared to young generation, garbage collection happens less frequently in old generation.<\/li>\n<\/ul>\n<p>To free up memory, the JVM must stop the application from running for at least a short time and execute the GC process. This process is called <strong>\u201cstop-the-world.\u201d<\/strong> This means all the threads, except for the GC threads, will stop executing until the GC threads are executed and objects are freed up by the garbage collector.<\/p>\n<p>Modern Java GC implementations try to minimize blocking \u201cstop-the-world\u201d stalls by doing as much work as possible in the background (i.e. using a separate thread), for example marking unreachable garbage instances while the application process continues to run.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Java_Garbage_Collection_-_Impact_on_Performance\"><\/span>Java Garbage Collection &#8211; Impact on Performance<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Garbage collection in the JVM consumes CPU resources when deciding which memory to free. Stopping the program or consuming high levels of CPU resources will have a negative impact on the end-user experience with users complaining that the application is slow. Various Java garbage collectors have been developed over time to reduce the application pauses that occur during garbage collection and at the same time to improve on the performance hit associated with garbage collection.<\/p>\n<p style=\"margin-bottom: 15px;\">Modern JVMs have multiple collectors (alternative garbage collection algorithms) for performing the GC activity:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-32305 size-full\" style=\"width: 400px;\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection.webp\" alt=\"Image listing types of Garbage Collection in Java- a list of 7 collectors: Serial, Parallel, CMS, G1, Epsilon, Shenandoah, ZGC \/ Z\" width=\"1002\" height=\"1224\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection.webp 1002w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-246x300.webp 246w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-838x1024.webp 838w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-768x938.webp 768w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-800x977.webp 800w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-310x379.webp 310w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/types-of-garbage-collection-140x171.webp 140w\" sizes=\"auto, (max-width: 1002px) 100vw, 1002px\" \/><\/p>\n<ul>\n<li><strong>Serial Garbage Collector:<\/strong> Single-threaded GC execution. Enable with <span style=\"color: #35ba00;\">-XX:+UseSerialGC.<\/span><\/li>\n<li><strong>Parallel Garbage Collector:<\/strong> Multiple minor threads executing GC in parallel. Enable with <span style=\"color: #35ba00;\">-XX:+UseParallelGC.<\/span><\/li>\n<li><strong>Concurrent Mark Sweep (CMS):<\/strong> Concurrent execution of some application threads with reduced stop-the-world GC frequency. Enable with <span style=\"color: #35ba00;\">-XX:+UseConcMarkSweepGC.<\/span> However, note that CMS was deprecated in JDK 9.<\/li>\n<li><strong>G1 Garbage Collector:<\/strong> Designed for big workloads, concurrent, minimizes pauses, adapts to machine conditions, string de-duplication feature reduces the overhead of strings. You can explicitly enable it using the JVM option <span style=\"color: #35ba00;\">-XX:+UseG1GC.<\/span><\/li>\n<li><strong>Epsilon Garbage Collector:<\/strong> Do-nothing GC for ultra-latency-sensitive or garbage-free applications. Use the following flags: <span style=\"color: #35ba00;\">-XX:+UnlockExperimentalVMOptions and -XX:+UseEpsilonGC<\/span><\/li>\n<li><strong>Shenandoah Garbage Collector:<\/strong> Concurrent GC with compaction and memory release while the application is running. Use the following flags: <span style=\"color: #35ba00;\">-XX:+UseShenandoahGC -XX:+UnlockExperimentalVMOptions -XX:ShenandoahGCMode=generational<\/span><\/li>\n<li><strong>ZGC (Z Garbage Collector):<\/strong> Experimental initially, designed for large heaps, concurrent, low pause times (&lt;10ms), supports small to massive heap sizes. ZGC can be enabled using the <span style=\"color: #35ba00;\">-XX:+UseZGC<\/span> JVM option.<\/li>\n<\/ul>\n<p>Many JVMs, such as Oracle HotSpot, JRockit, OpenJDK, IBM J9, and SAP JVM, use stop-the-world GC techniques &#8211; however, recent collectors such as G1GC and ZGC are changing this situation. Modern JVMs like <a href=\"https:\/\/www.azul.com\/products\/prime\/\">Azul Platform Prime<\/a> (formerly Zing) use <strong>Continuously Concurrent Compacting Collector (C4),<\/strong> which eliminates the stop-the-world GC pauses that limit scalability in the case of conventional JVMs.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_is_Monitoring_Java_Garbage_Collection_Important\"><\/span>Why is Monitoring Java Garbage Collection Important?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6819 size-full\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/06\/garbage-collection-important.jpg\" alt=\"Monitoring Garbage Collection is Important - an icon of an exclamation mark to highlight this\" width=\"160\" height=\"130\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/06\/garbage-collection-important.jpg 160w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/06\/garbage-collection-important-140x114.jpg 140w\" sizes=\"auto, (max-width: 160px) 100vw, 160px\" \/>Garbage collection can impact the performance of Java applications in unpredictable ways. When there is frequent GC activity, it adds a lot of CPU load and slows down application processing. In turn, this leads to slow execution of business transactions and ultimately affects the user experience of end-users accessing the Java application.<\/p>\n<p>Excessive garbage collection activity can occur due to a memory leak in the Java application. Insufficient memory allocation to the JVM can also result in increased garbage collection activity. And when excessive garbage collection activity happens, it often manifests as increased CPU usage of the JVM!<\/p>\n<p>For optimal <a href=\"https:\/\/www.eginnovations.com\/supported-technologies\/java-application-monitoring\">Java application performance,<\/a> it is critical to monitor a JVM\u2019s GC activity. For good performance, full GCs should be few and far between. The time spent on GC should be low \u2013 typically less than 5% and the percentage of CPU spent for garbage collection should also be very low (this allows application threads to use almost all the available CPU resources).<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_are_the_Key_Java_Garbage_Collection_Metrics_to_Monitor\"><\/span>What are the Key Java Garbage Collection Metrics to Monitor?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">To know if garbage collection is creating <a href=\"https:\/\/www.eginnovations.com\/blog\/top-10-java-performance-problems\/\">Java performance problems,<\/a> you need to track all aspects of the garbage collection activity in the JVM:<\/p>\n<ul>\n<li>When garbage collection happened<\/li>\n<li>How often garbage collection is happening in the JVM<\/li>\n<li>How much memory is being collected each time<\/li>\n<li>How long garbage collection is running for in the JVM<\/li>\n<li>Percentage of time spent by JVM for garbage collection<\/li>\n<li>What type of garbage collection happened \u2013 minor or full GC?<\/li>\n<li>JVM heap and non-heap memory usage<\/li>\n<li>CPU utilization of the JVM<\/li>\n<\/ul>\n<p>This allows you to identify when Java garbage collection is taking too long and impacting performance, which will help you to determine the optimal settings for each application based on historical patterns and trends.<\/p>\n<p><a href=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-view.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32339 size-full\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-image.webp\" alt=\"Screenshot of JVM Garbage Collector in the eG Enterprise console explaining time taken during garbage collection for Java applications\" width=\"750\" height=\"411\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-image.webp 750w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-image-300x164.webp 300w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-image-310x170.webp 310w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-garbage-collection-image-140x77.webp 140w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/a><\/p>\n<div class=\"img_caption\">Figure 1: Screenshot from <a style=\"font-size: 14px;\" href=\"https:\/\/www.eginnovations.com\/product\/application-performance-monitoring\/free-trial\">eG Enterprise<\/a> which tracks the time taken for Java garbage collection<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Troubleshooting_Java_Garbage_Collection_Issues\"><\/span>Troubleshooting Java Garbage Collection Issues<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>One way to troubleshoot whether the Java garbage collection process is impacting the performance of your application, when Java GC activity is excessive, is to take heap dumps of the JVM\u2019s memory and analyze the top memory consuming objects. Any unusually large objects are an indicator of memory leaks in the application code.<\/p>\n<p>On the other hand, if no object is occupying an unusually large amount of memory and if the percentage of memory used by any of the JVM\u2019s memory pools is close to 100%, this is an indicator that the JVM\u2019s memory configuration may be insufficient. In this case, you may need to increase the corresponding JVM memory pool for improved application performance.<\/p>\n<p><a href=\"https:\/\/www.eginnovations.com\/supported-technologies\/java-application-monitoring\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-32431\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner.jpg\" alt=\"\" width=\"800\" height=\"141\" srcset=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner.jpg 800w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner-300x53.jpg 300w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner-768x135.jpg 768w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner-310x55.jpg 310w, https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/08\/java-application-monitoring-banner-140x25.jpg 140w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">Now that we have fair understanding of Java garbage collection, let\u2019s summarize by answering some of key questions SREs and Java admins may have:<\/p>\n<ul>\n<li><strong>Is garbage collection in Java good or bad?<\/strong> Definitely good. But, as the adage goes, too much of anything is a bad thing. So, you need to make sure Java heap memory is properly configured and managed so that the GC activity is optimized.<\/li>\n<li><strong>When is Java GC needed?<\/strong> It is needed when there are unreferenced objects to be cleared out. Since it is not a manual activity, the JVM will automatically take care of this for you. From all the information above, you would have learned why GC is needed and when.<\/li>\n<li><strong>How to tune Java garbage collection?<\/strong> There are two common ways to do this:\n<ol style=\"margin-top: 10px;\">\n<li>Keep the number of objects passed to the old generation area to a minimum<\/li>\n<li>Configure the major (or full) GC time to be low<\/li>\n<\/ol>\n<\/li>\n<li>Some critical JVM parameters to configure for right-sizing the JVM\u2019s memory are -Xms, -Xmx, and -NewRatio (ratio of new generation and old generation size)<\/li>\n<li><strong>How to know when Java GC is not operating as expected?<\/strong> <a href=\"https:\/\/www.eginnovations.com\/blog\/jvm-monitoring-and-performance-assurance-for-java-based-banking-and-trading-applications\/\">JVM monitoring<\/a> is key. Make sure to track vital JVM metrics and be alerted when GC activity is deviating from the norm.<\/li>\n<\/ul>\n<div class=\"containers mb-4\" style=\"clear:both\">\n \t<div class=\"fixed-free-trial-div mb-3\" id=\"fixedsectioninfo_blog_btn\">\n \t\n \t<style>.containers_hide_row,.all_blogs_bottom{\n \tdisplay:none;\n   \n}\t<\/style>\n                <div class=\"box-style container row pt-4 pb-4  animatedParent animateOnce\" data-sequence=\"100\" style=\"border-bottom: 1px solid #ddd;border-top: 1px solid #ddd;background: #4b4b4b;padding: 15px 15px 0 15px;border-radius: 12px;\">\n                \n                <div class=\"text-center animated fadeIn go\"> \n                <p class=\"text-center mb-4\" style=\"    color: #fff;\">\n\neG Enterprise is an Observability solution for Modern IT. Monitor digital workspaces, <br\/>web applications, SaaS services, cloud and containers from a single pane of glass.\n<\/p>\n                <\/div>\n                    <div class=\"text-center pb-1 animated fadeIn go\" data-id=\"8\">\n                        <a class=\"border-btnhead-eg\"  href=\"https:\/\/www.eginnovations.com\/it-monitoring\/free-trial\"> <span style=\"font-family: GraphikMedium!important;color: #fff;\">Free Trial<\/span><\/a>\n                        <a href=\"https:\/\/www.eginnovations.com\/supported-technologies\/java-performance-monitoring\" class=\" border-btnhead-eg\" style=\"width:230px;   \"> <svg width=\"24\" height=\"24\" style=\"margin-top:-3px\" version=\"1.1\" id=\"Layer_1\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 26.5 26.5\" style=\"enable-background:new 0 0 26.5 26.5;\" xml:space=\"preserve\">\n<style type=\"text\/css\">\n\t.st2{fill:#fff !important;stroke:#fff !important;stroke-miterlimit:10;}\n\t\n\t\t.border-btnhead:hover .st2 {\n  fill: #ffffff !important;\n  stroke: #ffffff;\n}\n<\/style>\n<g>\n\t<g>\n\t\t<path class=\"st2\" d=\"M13.3,25.8c-6.9,0-12.5-5.6-12.5-12.5S6.4,0.8,13.3,0.8s12.5,5.6,12.5,12.5S20.2,25.8,13.3,25.8z M13.3,1.8\n\t\t\tC6.9,1.8,1.8,6.9,1.8,13.3S7,24.8,13.3,24.8s11.5-5.2,11.5-11.5S19.6,1.8,13.3,1.8z M11.2,18.1c-0.2,0-0.4-0.1-0.6-0.2\n\t\t\tc-0.3-0.2-0.6-0.6-0.6-1V9.7c0-0.4,0.2-0.8,0.6-1c0.3-0.2,0.8-0.2,1.2,0l6.2,3.6c0.3,0.2,0.6,0.6,0.6,1s-0.2,0.8-0.6,1l-6.2,3.6\n\t\t\tC11.6,18,11.4,18.1,11.2,18.1z\"\/>\n\t<\/g>\n<\/g>\n<\/svg> <span style=\"font-family: GraphikMedium!important;color: #fff;\">&nbsp;See the platform<\/span><\/a>\n                    <\/div>\n                <\/div>\n                \n                 <\/div>\n            <\/div>\n<h2><span class=\"ez-toc-section\" id=\"Monitoring_Java_application_performance_with_eG_Enterprise\"><\/span>Monitoring Java application performance with eG Enterprise<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"margin-bottom: 15px;\">With eG Enterprise, you can optimize JVM and Java application performance:<\/p>\n<ol>\n<li>Set up monitoring quickly with prebuilt Java dashboards.<\/li>\n<li>Visualize metrics like garbage collection CPU time, CPU utilization, memory heap usage, and more.<\/li>\n<li>Identify and triage issues, detect memory leaks and performance bottlenecks.<\/li>\n<li>Fine-tune memory heap and garbage collector configurations for optimal performance.<\/li>\n<li>Leverage prebuilt alerts for high CPU usage, memory, transaction errors, and Apdex score.<\/li>\n<li>Notify teams via Slack and PagerDuty for prompt issue resolution.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/www.eginnovations.com\/product\/application-performance-monitoring\/free-trial\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-32318\" src=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2023\/07\/java-signup-banner.jpg\" alt=\"\" width=\"800\" height=\"150\" \/><\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Java Garbage Collection: Basics What is Garbage Collection in Java?. In Java applications, objects are stored in a memory area called the \u201cheap\u201d, which is dedicated to dynamically allocated objects. If left unattended, these objects can accumulate and deplete the available memory in the heap &#8211; eventually leading to an OutOfMemoryError. The Java Virtual Machine [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_lmt_disableupdate":"no","_lmt_disable":"","footnotes":""},"categories":[27],"tags":[1182,1152,979,1218,651,1216,527,1223,171,435,174,528,1496,650,1222,1217,1225,1221,1546,1220,176,177,1547,502,1497,578,1224,529,1203,1219],"class_list":["post-32260","post","type-post","status-publish","format-standard","hentry","category-java-monitoring","tag-appdynamics","tag-datadog","tag-dynatrace","tag-g1gc","tag-garbage-collection","tag-garbage-collection-in-java","tag-gc","tag-gc-performance","tag-java","tag-java-apm","tag-java-application-performance","tag-java-applications","tag-java-garbage-collector","tag-java-gc","tag-java-gc-pause","tag-java-gc-performance","tag-java-heap","tag-java-heap-dump","tag-java-jmx","tag-java-memory-leak","tag-java-monitoring","tag-java-performance","tag-jmx-metrics","tag-jvm","tag-jvm-garbage-collectors","tag-jvm-monitoring","tag-jvm-stalled","tag-jvm-tuning","tag-newrelic","tag-stop-the-world-gc"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Garbage Collection in Java: Best Practices | eG Innovations<\/title>\n<meta name=\"description\" content=\"Understand garbage collection in Java, its mechanisms, and how it affects application performance. Dive in for insights and best practices. \u2713 Read more!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Garbage Collection in Java: Best Practices | eG Innovations\" \/>\n<meta property=\"og:description\" content=\"Understand garbage collection in Java, its mechanisms, and how it affects application performance. Dive in for insights and best practices. \u2713 Read more!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/\" \/>\n<meta property=\"og:site_name\" content=\"eG Innovations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eGInnovations\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-03T12:38:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-10T10:03:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/Garbage-Collection-Java-Socialbanner.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Arun Aravamudhan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/Garbage-Collection-Java-Socialbanner.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/x.com\/perfclarity\" \/>\n<meta name=\"twitter:site\" content=\"@eginnovations\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arun Aravamudhan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Garbage Collection in Java: Best Practices | eG Innovations","description":"Understand garbage collection in Java, its mechanisms, and how it affects application performance. Dive in for insights and best practices. \u2713 Read more!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/","og_locale":"en_US","og_type":"article","og_title":"Garbage Collection in Java: Best Practices | eG Innovations","og_description":"Understand garbage collection in Java, its mechanisms, and how it affects application performance. Dive in for insights and best practices. \u2713 Read more!","og_url":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/","og_site_name":"eG Innovations","article_publisher":"https:\/\/www.facebook.com\/eGInnovations","article_published_time":"2023-08-03T12:38:07+00:00","article_modified_time":"2024-12-10T10:03:49+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/Garbage-Collection-Java-Socialbanner.jpg","type":"image\/jpeg"}],"author":"Arun Aravamudhan","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/05\/Garbage-Collection-Java-Socialbanner.jpg","twitter_creator":"@https:\/\/x.com\/perfclarity","twitter_site":"@eginnovations","twitter_misc":{"Written by":"Arun Aravamudhan","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#article","isPartOf":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/"},"author":{"name":"Arun Aravamudhan","@id":"https:\/\/www.eginnovations.com\/blog\/#\/schema\/person\/d788cb81df96a940429c3f5a3b294a6a"},"headline":"A Comprehensive Guide to Garbage Collection in Java","datePublished":"2023-08-03T12:38:07+00:00","dateModified":"2024-12-10T10:03:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/"},"wordCount":2512,"publisher":{"@id":"https:\/\/www.eginnovations.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg","keywords":["appdynamics","datadog","Dynatrace","G1GC","Garbage collection","garbage collection in java","GC","GC performance","Java","Java APM","Java Application Performance","Java applications","java garbage collector","Java GC","java gc pause","java GC performance","java heap","java heap dump","java jmx","java memory leak","Java Monitoring","Java performance","jmx metrics","JVM","JVM Garbage Collectors","JVM Monitoring","JVM stalled","JVM Tuning","NewRelic","stop the world gc"],"articleSection":["Java Monitoring"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/","url":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/","name":"Garbage Collection in Java: Best Practices | eG Innovations","isPartOf":{"@id":"https:\/\/www.eginnovations.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#primaryimage"},"image":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg","datePublished":"2023-08-03T12:38:07+00:00","dateModified":"2024-12-10T10:03:49+00:00","description":"Understand garbage collection in Java, its mechanisms, and how it affects application performance. Dive in for insights and best practices. \u2713 Read more!","breadcrumb":{"@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#primaryimage","url":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg","contentUrl":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2018\/04\/garbage-collection.jpg","width":160,"height":130,"caption":"Excessive Garbage Collection"},{"@type":"BreadcrumbList","@id":"https:\/\/www.eginnovations.com\/blog\/what-is-garbage-collection-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.eginnovations.com\/blog\/"},{"@type":"ListItem","position":2,"name":"A Comprehensive Guide to Garbage Collection in Java"}]},{"@type":"WebSite","@id":"https:\/\/www.eginnovations.com\/blog\/#website","url":"https:\/\/www.eginnovations.com\/blog\/","name":"eG Innovations","description":"IT Performance Monitoring Insights","publisher":{"@id":"https:\/\/www.eginnovations.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.eginnovations.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.eginnovations.com\/blog\/#organization","name":"eG Innovations","alternateName":"eg innovations","url":"https:\/\/www.eginnovations.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.eginnovations.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2014\/07\/eg-logo-dark-gray1_new.jpg","contentUrl":"https:\/\/www.eginnovations.com\/blog\/wp-content\/uploads\/2014\/07\/eg-logo-dark-gray1_new.jpg","width":362,"height":235,"caption":"eG Innovations"},"image":{"@id":"https:\/\/www.eginnovations.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/eGInnovations","https:\/\/x.com\/eginnovations"]},{"@type":"Person","@id":"https:\/\/www.eginnovations.com\/blog\/#\/schema\/person\/d788cb81df96a940429c3f5a3b294a6a","name":"Arun Aravamudhan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.eginnovations.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7ff42334d908fb4060880a4487331e4a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7ff42334d908fb4060880a4487331e4a?s=96&d=mm&r=g","caption":"Arun Aravamudhan"},"sameAs":["https:\/\/www.linkedin.com\/in\/arun-aravamudhan\/","https:\/\/x.com\/https:\/\/x.com\/perfclarity"],"url":"https:\/\/www.eginnovations.com\/blog\/author\/arun-aravamudhan\/"}]}},"modified_by":"Review eG","_links":{"self":[{"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/posts\/32260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/comments?post=32260"}],"version-history":[{"count":0,"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/posts\/32260\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/media?parent=32260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/categories?post=32260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.eginnovations.com\/blog\/wp-json\/wp\/v2\/tags?post=32260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}