{"id":42785,"date":"2024-05-31T10:43:49","date_gmt":"2024-05-31T10:43:49","guid":{"rendered":"https:\/\/accuweb.cloud\/resource\/?post_type=faq&#038;p=42785"},"modified":"2024-05-31T10:43:49","modified_gmt":"2024-05-31T10:43:49","slug":"garbage-collection-types-settings","status":"publish","type":"faq","link":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings","title":{"rendered":"Java Garbage Collection Types and Settings in AccuWeb.Cloud"},"content":{"rendered":"<h1 class=\"ack-h1\">Java Garbage Collection Types and Settings in AccuWeb.Cloud<\/h1>\n<p>Performance and cost are crucial in <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/application\">application hosting<\/a>. We often wonder how to reduce costs without hurting app performance. This article covers automatic memory management for <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/application\/java-hosting\">Java<\/a> apps on AccuWeb.Cloud using garbage collection.<\/p>\n<h2 class=\"ack-h2\">Java Garbage Collection Overview<\/h2>\n<p>Garbage Collection (GC) is automatic memory management. It finds unused data in memory and frees up space for reuse.<\/p>\n<p>When an object is created, it uses memory. This memory stays allocated as long as the object is in use. Once an object is no longer needed, its memory can be reclaimed, saving costs on unused resources.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-42786 size-full\" title=\"Java Garbage Collection\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\" alt=\"Java Garbage Collection\" width=\"642\" height=\"306\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png 642w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection-300x143.png 300w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><\/a><\/p>\n<p>We tested different Garbage Collectors (GC) and chose the best ones for Java apps on Accuweb.cloud, considering the platform&#8217;s automatic vertical scaling. We adjusted the default GC settings to enhance user benefits.<\/p>\n<h2 class=\"ack-h2\">AccuWeb.Cloud supports these Garbage Collectors (GCs)<\/h2>\n<ul class=\"ack-ul\">\n<li><strong>G1 GC (-XX:+UseG1GC):<\/strong> This is the default GC in Accuweb.cloud PaaS. G1 is designed for servers with many processors and lots of memory. It divides memory into fixed-sized regions and collects garbage from regions with the least live data first.<\/li>\n<li><strong>Shenandoah GC (-XX:+UseShenandoahGC):<\/strong> This GC works in parallel with the application to minimize pauses. It efficiently handles both small and large heaps without long pauses. It also uses the option <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/wiki.openjdk.org\/display\/shenandoah\/Main#Main-Heuristics\">-XX:ShenandoahGCHeuristics=compact<\/a>.<\/li>\n<li><strong>ZGC (-XX:+UseZGC):<\/strong> This low-latency GC is ideal for applications with large heaps. It does most of the garbage collection work in parallel with the application, minimizing the impact on response time. It uses the option -XX:ZCollectionInterval=$ZCOLLECTION_INTERVAL to set the maximum interval between GC cycles.<\/li>\n<li><strong>Epsilon GC (-XX:+UseEpsilonGC):<\/strong> This passive GC only handles memory allocation and doesn&#8217;t reclaim memory. When the heap is full, the JVM stops. Epsilon GC is useful for debugging memory usage and measuring application performance.<\/li>\n<li><strong>Parallel GCs<\/strong>\n<ul class=\"ack-ul\">\n<li><strong>ParNew GC (-XX:+UseParNewGC):<\/strong> A &#8220;stop-the-world&#8221; multithreaded GC that primarily collects young generation objects. Since the young generation is usually small, ParNew works quickly and doesn\u2019t significantly impact your application. It also compacts unused RAM, supporting Accuweb.cloud&#8217;s automatic vertical scaling feature.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul class=\"ack-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"ack-ul\">\n<li><strong>Parallel GC (-XX:+UseParallelGC):<\/strong> This GC performs parallel collection on the young generation only. Unlike ParNew, it cannot be used simultaneously with ConcMarkSweep GC.<\/li>\n<li><strong>Parallel Old GC (-XX:+UseParallelOldGC):<\/strong> Uses a parallel &#8220;mark and compact&#8221; algorithm. It stops all application threads, then uses multiple threads to mark and compact memory.<\/li>\n<li>ConcMarkSweep GC (-XX:+UseConcMarkSweepGC): Designed for applications needing shorter GC pauses and can share processor resources with the GC while running. It is suitable for applications that require low GC pause times.<\/li>\n<li><strong>Serial GC (-XX:+UseSerialGC):<\/strong> Performs GC in a single thread with the lowest memory usage of all GCs, but causes long pauses that can degrade application performance.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Note:<\/strong> The Openj9 Java engine does not support the GCs listed above. Instead, it supports:<\/p>\n<ul class=\"ack-ul\">\n<li><a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/eclipse.dev\/openj9\/docs\/xxidletuningcompactonidle\/\">-XX:+IdleTuningCompactOnIdle<\/a><\/li>\n<li><a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/eclipse.dev\/openj9\/docs\/xxidletuninggconidle\/\">-XX:+IdleTuningGcOnIdle<\/a><\/li>\n<li><a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/eclipse.dev\/openj9\/docs\/xxidletuningminidlewaittime\/\">-XX:IdleTuningMinIdleWaitTime=180<\/a><\/li>\n<li><a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/eclipse.dev\/openj9\/docs\/xjit\/\">-Xjit:waitTimeToEnterDeepIdleMode=50000<\/a><\/li>\n<\/ul>\n<div class=\"article-space\"><\/div>\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"38668\" class=\"elementor elementor-38668\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"elementor_library\">\n\t\t\t        <section class=\"elementor-section elementor-top-section elementor-element elementor-element-882321f elementor-section-boxed elementor-section-height-default elementor-section-height-default ct-header-fixed-none ct-row-max-none\" data-id=\"882321f\" data-element_type=\"section\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n            \n                        <div class=\"elementor-container elementor-column-gap-default \">\n                    <div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7cc79cc\" data-id=\"7cc79cc\" data-element_type=\"column\">\n        <div class=\"elementor-widget-wrap elementor-element-populated\">\n                    \n        \t\t<div class=\"elementor-element elementor-element-e31b40f elementor-widget elementor-widget-shortcode\" data-id=\"e31b40f\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t            <\/div>\n        <\/div>\n                    <\/div>\n        <\/section>\n        \t\t<\/div>\n\t\t\n<div class=\"article-space\"><\/div>\n<h2 class=\"ack-h2\">Default JVM Options in AccuWeb.Cloud PaaS<\/h2>\n<p>By default, Accuweb.cloud PaaS uses G1 GC for JVM 8 and newer versions. For older versions, it uses ParNew GC. For JVM versions below 12, Accuweb.cloud adds the <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/jelastic-jps\/java-memory-agent\">accuweb-cloud-gc-agent.jar<\/a> to enable vertical scaling.<\/p>\n<p>For JVM 12 and newer versions, the platform includes integrated vertical scaling to ensure G1 GC is triggered with these preset container <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/variables\/\">variables<\/a>:<\/p>\n<ul class=\"ack-ul\">\n<li><strong>G1PERIODIC_GC_INTERVAL=3000:<\/strong> Interval between garbage collections in milliseconds (default is 15 minutes).<\/li>\n<li><strong>GC_SYS_LOAD_THRESHOLD_RATE=0.3:<\/strong> Multiplier to adjust the G1PeriodicGCSystemLoadThreshold value.<\/li>\n<li><strong>*G1PERIODIC_GC_SYS_LOAD_THRESHOLD={CPU_cores_number}GC_SYS_LOAD_THRESHOLD_RATE:<\/strong> Triggers garbage collection if the average one-minute system load is below this value. Ignored if set to zero.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Default-JVM-options.png\"><img decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42787 size-full\" title=\"Default JVM options\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Default-JVM-options.png\" alt=\"Default JVM options\" width=\"971\" height=\"546\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Default-JVM-options.png 971w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Default-JVM-options-300x169.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Default-JVM-options-768x432.png 768w\" sizes=\"(max-width: 971px) 100vw, 971px\" \/><\/a><\/p>\n<p>You can check your Java process settings by running <b>ps -ax | grep java<\/b>. You will see something like this:<\/p>\n<p><b>\/usr\/java\/libericajdk-12.0.1\/bin\/java.orig -server -XX:G1PeriodicGCSystemLoadThreshold=0.6 -XX:G1PeriodicGCInterval=900k -XX:+UseStringDeduplication -XX:+UseG1GC -Xmaxf0.3 -Xminf0.1 -Xmx1638M -Xmn30M -Xms32M -jar Accuweb.cloud-helloworld-1.1.war<\/b><\/p>\n<p>AccuWeb.Cloud automatically configures these parameters:<\/p>\n<ul class=\"ack-ul\">\n<li>Xmx: 80% of total available RAM in the container<\/li>\n<li>Xms: 32MB<\/li>\n<li>Xmn: 30MB<\/li>\n<\/ul>\n<p>For JVM versions 12 and above, the platform also configures these Java options:<\/p>\n<ul class=\"ack-ul\">\n<li><strong>G1PeriodicGCSystemLoadThreshold=CPU_COUNT*0.3:<\/strong> 30% of the load average based on the number of CPU cores available.<\/li>\n<li><strong>G1PeriodicGCInterval=900k:<\/strong> 15 minutes between garbage collection pauses.<\/li>\n<\/ul>\n<div class=\"article-space\"><\/div>\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"38668\" class=\"elementor elementor-38668\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"elementor_library\">\n\t\t\t        <section class=\"elementor-section elementor-top-section elementor-element elementor-element-882321f elementor-section-boxed elementor-section-height-default elementor-section-height-default ct-header-fixed-none ct-row-max-none\" data-id=\"882321f\" data-element_type=\"section\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n            \n                        <div class=\"elementor-container elementor-column-gap-default \">\n                    <div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7cc79cc\" data-id=\"7cc79cc\" data-element_type=\"column\">\n        <div class=\"elementor-widget-wrap elementor-element-populated\">\n                    \n        \t\t<div class=\"elementor-element elementor-element-e31b40f elementor-widget elementor-widget-shortcode\" data-id=\"e31b40f\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t            <\/div>\n        <\/div>\n                    <\/div>\n        <\/section>\n        \t\t<\/div>\n\t\t\n<div class=\"article-space\"><\/div>\n<h2 class=\"ack-h2\">Customizing GC Settings in AccuWeb.Cloud PaaS<\/h2>\n<p>If you think adjusting the default settings can improve performance or memory usage, you can change them based on your application&#8217;s needs. Only do this if you understand the effects on your application.<\/p>\n<p>Set custom GC parameters using <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/resource\/how-to-add-edit-and-remove-environment-variables\/\">Environment Variables<\/a> (not Java options):<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables-1.png\"><img decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42788 size-full\" title=\"Variables\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables-1.png\" alt=\"Variables\" width=\"1010\" height=\"529\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables-1.png 1010w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables-1-300x157.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables-1-768x402.png 768w\" sizes=\"(max-width: 1010px) 100vw, 1010px\" \/><\/a><\/p>\n<ul class=\"ack-ul\">\n<li><strong>_JAVA_OPTIONS and JAVA_TOOL_OPTIONS:<\/strong> Use these to change the default GC type. Example: _JAVA_OPTIONS=&#8221;-XX:+UseShenandoahGC&#8221;<\/li>\n<li><strong>GC_DEF:<\/strong> Type of Garbage Collector. Example: GC_DEF=G1GC<\/li>\n<\/ul>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Types-of-garbage-collector.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42789 size-full\" title=\"Types of garbage collector\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Types-of-garbage-collector.png\" alt=\"Types of garbage collector\" width=\"968\" height=\"541\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Types-of-garbage-collector.png 968w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Types-of-garbage-collector-300x168.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Types-of-garbage-collector-768x429.png 768w\" sizes=\"(max-width: 968px) 100vw, 968px\" \/><\/a><\/p>\n<ul class=\"ack-ul\">\n<li><strong>XMX_DEF_PERCENT:<\/strong> Percentage of RAM for XMX. Example: XMX_DEF_PERCENT=80<\/li>\n<li><strong>XMX_DEF (or XMX):<\/strong> Maximum Java heap size. Example: XMX_DEF=1638 (for 2048MB RAM)<\/li>\n<li><strong>XMS_DEF (or XMS):<\/strong> Initial Java heap size. Example:XMS=32M<\/li>\n<li><strong>XMN_DEF:<\/strong> Size of the heap for the young generation. Example: XMN=30M<\/li>\n<li><strong>G1PERIODIC_GC_INTERVAL (for openJDK 12\/13 only):<\/strong> Frequency of G1 Periodic Collection in milliseconds. Example: G1PERIODIC_GC_INTERVAL=900 (15 minutes)<\/li>\n<li><strong>G1PERIODIC_GC_SYS_LOAD_THRESHOLD (for openJDK 12\/13 only):<\/strong> Allows G1 Periodic Collection if the system load is below this value. Example: G1PERIODIC_GC_SYS_LOAD_THRESHOLD={CPU_cores_number}*{GC_SYS_LOAD_THRESHOLD_RATE}<\/li>\n<li><strong>GC_SYS_LOAD_THRESHOLD_RATE (for openJDK 12\/13 only):<\/strong> Multiplier to adjust G1PeriodicGCSystemLoadThreshold. Example: GC_SYS_LOAD_THRESHOLD_RATE=0.3<\/li>\n<li><strong>FULL_GC_AGENT_DEBUG:<\/strong> Enables or disables debug mode for tracking GC processes in logs. Example: FULL_GC_AGENT_DEBUG=true<\/li>\n<li><strong>FULL_GC_PERIOD:<\/strong> Interval in seconds between full GC calls. Example: FULL_GC_PERIOD=900 (15 minutes)<\/li>\n<li><strong>MAXPERMSIZE:<\/strong> Defined for JVM versions below 8 and RAM &gt; 800MB. Example: MAXPERMSIZE=163 (calculated based on Xmx)<\/li>\n<li><strong>XMINF_DEF:<\/strong> Minimum free space in the heap after GC to trigger heap expansion. Example: XMINF_DEF=0.1<\/li>\n<li><strong>XMAXF_DEF:<\/strong> Controls heap compaction if free space exceeds this value. Example: XMAXF_DEF=0.3<\/li>\n<\/ul>\n<p>You can also pass these parameters via the variables.conf file in the container.<\/p>\n<p>Paths to config, executable, or log files vary by Java server and can be accessed via <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/configuration-of-file-manager\/\">Configuration File Manager<\/a> or <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/ssh-access-methods-overview\/\">SSH<\/a>.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JAS-variable-path.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42790 size-full\" title=\"JAS variable path\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JAS-variable-path.png\" alt=\"JAS variable path\" width=\"728\" height=\"439\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JAS-variable-path.png 728w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JAS-variable-path-300x181.png 300w\" sizes=\"(max-width: 728px) 100vw, 728px\" \/><\/a><\/p>\n<p><strong>Step 1:<\/strong> Open configuration files to set up your Java server.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Config-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42791 size-full\" title=\"Config\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Config-5.png\" alt=\"Config\" width=\"1012\" height=\"573\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Config-5.png 1012w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Config-5-300x170.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Config-5-768x435.png 768w\" sizes=\"(max-width: 1012px) 100vw, 1012px\" \/><\/a><\/p>\n<p><strong>Step 2:<\/strong> For Tomcat, go to the <strong>opt &gt; tomcat &gt; conf &gt; variables.conf<\/strong> file.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables.conf_-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42792 size-full\" title=\"Variables.conf\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables.conf_-2.png\" alt=\"Variables.conf\" width=\"1007\" height=\"610\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables.conf_-2.png 1007w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables.conf_-2-300x182.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Variables.conf_-2-768x465.png 768w\" sizes=\"(max-width: 1007px) 100vw, 1007px\" \/><\/a><\/p>\n<p>In this file, you can change default garbage collector settings or add a different one to replace the default (G1).<\/p>\n<p>For example, if you want to use ShenandoahGC instead, just add it to the variables.conf file like this:<\/p>\n<ul class=\"ack-ul\">\n<li><strong>-XX:+UseShenandoahGC<\/strong><\/li>\n<\/ul>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Options-to-change-settings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42793 size-full\" title=\"Options to change settings\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Options-to-change-settings.png\" alt=\"Options to change settings\" width=\"1011\" height=\"497\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Options-to-change-settings.png 1011w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Options-to-change-settings-300x147.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Options-to-change-settings-768x378.png 768w\" sizes=\"(max-width: 1011px) 100vw, 1011px\" \/><\/a><\/p>\n<p>After this, your Java server will use only the specified garbage collector, regardless of allocated resources.<\/p>\n<p>You can also adjust how JVM handles its heap memory with other JAVA options in this file.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Adjust-JVM-heap-memory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42794 size-full\" title=\"Adjust JVM heap memory\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Adjust-JVM-heap-memory.png\" alt=\"Adjust JVM heap memory\" width=\"1011\" height=\"499\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Adjust-JVM-heap-memory.png 1011w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Adjust-JVM-heap-memory-300x148.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Adjust-JVM-heap-memory-768x379.png 768w\" sizes=\"(max-width: 1011px) 100vw, 1011px\" \/><\/a><\/p>\n<p>Once properly configured, you can see the garbage collector in action on the <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/statistics-monitoring-of-node\/\">Statistics<\/a> tab.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Statistics.png\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-42795 size-full\" title=\"Statistics\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Statistics.png\" alt=\"Statistics\" width=\"1007\" height=\"577\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Statistics.png 1007w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Statistics-300x172.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Statistics-768x440.png 768w\" sizes=\"(max-width: 1007px) 100vw, 1007px\" \/><\/a><\/p>\n<p>That\u2019s it! Enjoy better resource efficiency when running your <a class=\"ack-link-color\" target=\"_blank\" rel=\"noopener\" href=\"https:\/\/accuweb.cloud\/application\/java-hosting\">Java<\/a> apps in the cloud.<\/p>\n<div class=\"cta-btn-top-space\"><\/div>\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"38668\" class=\"elementor elementor-38668\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"elementor_library\">\n\t\t\t        <section class=\"elementor-section elementor-top-section elementor-element elementor-element-882321f elementor-section-boxed elementor-section-height-default elementor-section-height-default ct-header-fixed-none ct-row-max-none\" data-id=\"882321f\" data-element_type=\"section\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n            \n                        <div class=\"elementor-container elementor-column-gap-default \">\n                    <div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7cc79cc\" data-id=\"7cc79cc\" data-element_type=\"column\">\n        <div class=\"elementor-widget-wrap elementor-element-populated\">\n                    \n        \t\t<div class=\"elementor-element elementor-element-e31b40f elementor-widget elementor-widget-shortcode\" data-id=\"e31b40f\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t            <\/div>\n        <\/div>\n                    <\/div>\n        <\/section>\n        \t\t<\/div>\n\t\t\n<div class=\"cta-btn-mob-space\"><\/div>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","class_list":["post-42785","faq","type-faq","status-publish","hentry","faq_topics-java","faq_topics-java-garbage-collector","faq_topics-kb","faq_topics-product-documentation","faq_topics-types-and-settings"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.10 (Yoast SEO v24.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java Garbage Collection Default and Customize Types | AccuWeb.Cloud<\/title>\n<meta name=\"description\" content=\"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Garbage Collection Types and Settings in AccuWeb.Cloud\" \/>\n<meta property=\"og:description\" content=\"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\" \/>\n<meta property=\"og:site_name\" content=\"AccuWeb Cloud\" \/>\n<meta property=\"og:image\" content=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#article\",\"isPartOf\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\"},\"author\":{\"name\":\"Jilesh Patadiya\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58\"},\"headline\":\"Java Garbage Collection Types and Settings in AccuWeb.Cloud\",\"datePublished\":\"2024-05-31T10:43:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\"},\"wordCount\":1175,\"publisher\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage\"},\"thumbnailUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\",\"inLanguage\":\"en-US\"},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\",\"url\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\",\"name\":\"Java Garbage Collection Default and Customize Types | AccuWeb.Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage\"},\"thumbnailUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\",\"datePublished\":\"2024-05-31T10:43:49+00:00\",\"description\":\"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.\",\"breadcrumb\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/accuweb.cloud\/resource\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Garbage Collection Types and Settings in AccuWeb.Cloud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"name\":\"AccuWeb Cloud\",\"description\":\"Cutting Edge Cloud Computing\",\"publisher\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\",\"name\":\"AccuWeb.Cloud\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"width\":156,\"height\":87,\"caption\":\"AccuWeb.Cloud\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58\",\"name\":\"Jilesh Patadiya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g\",\"caption\":\"Jilesh Patadiya\"},\"description\":\"Jilesh Patadiya, the visionary Co-Founder and Chief Technology Officer (CTO) behind AccuWeb.Cloud. Founder &amp; CTO at AccuWebHosting.com. He shares his web hosting insights on the AccuWeb.Cloud blog. He mostly writes on the latest web hosting trends, WordPress, storage technologies, and Windows and Linux hosting platforms.\",\"sameAs\":[\"https:\/\/accuweb.cloud\/resource\",\"https:\/\/www.facebook.com\/accuwebhosting\",\"https:\/\/www.instagram.com\/accuwebhosting\/\",\"https:\/\/www.linkedin.com\/company\/accuwebhosting\/\",\"https:\/\/x.com\/accuwebhosting\",\"https:\/\/www.youtube.com\/c\/Accuwebhosting\"],\"url\":\"https:\/\/accuweb.cloud\/resource\/author\/accuwebadmin\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Garbage Collection Default and Customize Types | AccuWeb.Cloud","description":"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.","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:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings","og_locale":"en_US","og_type":"article","og_title":"Java Garbage Collection Types and Settings in AccuWeb.Cloud","og_description":"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.","og_url":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings","og_site_name":"AccuWeb Cloud","og_image":[{"url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#article","isPartOf":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings"},"author":{"name":"Jilesh Patadiya","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58"},"headline":"Java Garbage Collection Types and Settings in AccuWeb.Cloud","datePublished":"2024-05-31T10:43:49+00:00","mainEntityOfPage":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings"},"wordCount":1175,"publisher":{"@id":"https:\/\/accuweb.cloud\/resource\/#organization"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage"},"thumbnailUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png","inLanguage":"en-US"},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings","url":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings","name":"Java Garbage Collection Default and Customize Types | AccuWeb.Cloud","isPartOf":{"@id":"https:\/\/accuweb.cloud\/resource\/#website"},"primaryImageOfPage":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage"},"thumbnailUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png","datePublished":"2024-05-31T10:43:49+00:00","description":"Discover how to optimize default and customized types Java garbage collection and for AccuWeb.Cloud platform to achieve maximum performance.","breadcrumb":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#primaryimage","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/Java-Garbage-Collection.png"},{"@type":"BreadcrumbList","@id":"https:\/\/accuweb.cloud\/resource\/articles\/garbage-collection-types-settings#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/accuweb.cloud\/resource\/"},{"@type":"ListItem","position":2,"name":"Java Garbage Collection Types and Settings in AccuWeb.Cloud"}]},{"@type":"WebSite","@id":"https:\/\/accuweb.cloud\/resource\/#website","url":"https:\/\/accuweb.cloud\/resource\/","name":"AccuWeb Cloud","description":"Cutting Edge Cloud Computing","publisher":{"@id":"https:\/\/accuweb.cloud\/resource\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/accuweb.cloud\/resource\/#organization","name":"AccuWeb.Cloud","url":"https:\/\/accuweb.cloud\/resource\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","width":156,"height":87,"caption":"AccuWeb.Cloud"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58","name":"Jilesh Patadiya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g","caption":"Jilesh Patadiya"},"description":"Jilesh Patadiya, the visionary Co-Founder and Chief Technology Officer (CTO) behind AccuWeb.Cloud. Founder &amp; CTO at AccuWebHosting.com. He shares his web hosting insights on the AccuWeb.Cloud blog. He mostly writes on the latest web hosting trends, WordPress, storage technologies, and Windows and Linux hosting platforms.","sameAs":["https:\/\/accuweb.cloud\/resource","https:\/\/www.facebook.com\/accuwebhosting","https:\/\/www.instagram.com\/accuwebhosting\/","https:\/\/www.linkedin.com\/company\/accuwebhosting\/","https:\/\/x.com\/accuwebhosting","https:\/\/www.youtube.com\/c\/Accuwebhosting"],"url":"https:\/\/accuweb.cloud\/resource\/author\/accuwebadmin"}]}},"_links":{"self":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/42785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/comments?post=42785"}],"version-history":[{"count":4,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/42785\/revisions"}],"predecessor-version":[{"id":42799,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/42785\/revisions\/42799"}],"wp:attachment":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/media?parent=42785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}