JVM Heap Memory Region Segmentation for Selective Garbage Collection
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional garbage collection processes in JVMs suspend all threads except the garbage collection thread, leading to prolonged service disruptions and increased response times due to the need to clear the entire heap memory, affecting the ability of application programs to provide external services.
Innovation Solution
Implementing a resource reclamation method that allows for selective memory region reclamation in the JVM, where only the memory region corresponding to a target tenant is reclaimed, enabling other tenants' threads to continue running and providing services without interruption.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of energy
If the entire heap memory is reclaimed during garbage collection, then memory resources are fully released, but all program threads are suspended and service disruption time increases
Solution Approach 1:
The heap memory is divided into multiple memory regions, each corresponding to different tenants. The garbage collection process is segmented to reclaim only the memory region of the target tenant instead of the entire heap memory. This segmentation allows selective reclamation of memory resources while leaving other tenants' memory regions untouched, thus suspending only the target tenant's threads rather than all threads, which reduces service disruption time while still achieving memory resource release.
2Loss of energy
If the entire heap memory is reclaimed during garbage collection, then memory resources are fully released, but system responsiveness decreases due to full suspension
Solution Approach 1:
The heap memory is divided into multiple memory regions corresponding to different tenants. The garbage collection process targets only one specific memory region at a time rather than the entire heap. This segmentation enables the system to release memory resources incrementally while maintaining responsiveness, as only the target tenant's threads are suspended during each collection cycle while other tenants continue to serve requests normally.
3Loss of time
If selective memory region reclamation is performed, then service disruption time is reduced, but memory resource release may be incomplete
Solution Approach 1:
The garbage collection process is performed periodically on different tenant memory regions in a cyclic manner. Instead of suspending all threads once to reclaim the entire heap memory, the system performs multiple shorter collection cycles, each targeting a different tenant's memory region. Over time, this periodic selective reclamation achieves complete memory resource release while minimizing service disruption at any given moment, as each individual collection cycle affects only one tenant.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Embodiments of the application provide a resource reclamation method and a resource reclamation apparatus. The method includes: determining a memory region corresponding to a target tenant included by a heap memory as a target region; and performing resource reclamation on the target region to release the target region.