On Fri, 27 May 2022 07:22:11 GMT, Thomas Stuefe <[email protected]> wrote:

>>> I think the right fix is to just convert the MetaspacePool into 
>>> NonClassMetaspacePool and only report the non-class values.
>> 
>> Yes, it's okay for me. But I have another concern.
>> 
>> The compressed class pool is not directly used by other VM components. 
>> However, memory pools are exposed via java management APIs. At JDK level, 
>> users could obtain memory pools and choose a specified pool by name. If 
>> adapting the first solution, I guess it's somewhat strange for users to 
>> understand what is `Non Class Space`:
>> 
>>   private static MemoryPoolMXBean getMemoryPool(String name) {
>>         List<MemoryPoolMXBean> pools = 
>> ManagementFactory.getMemoryPoolMXBeans();
>>         for (MemoryPoolMXBean pool : pools) {
>>             if (pool.getName().equals(name)) {
>>                 return pool;
>>             }
>>         }
>> 
>>         throw new RuntimeException("Expected to find a memory pool with name 
>> " + name);
>>     }
>>   public static void foo() {
>>      MemoryPoolMXBean a = getMemoryPool("Compressed Class Space");
>>      MemoryPoolMXBean a = getMemoryPool("Non Class Space");
>>   }
>> 
>> If we remove `CompressedClassSpace`, we can only 
>> `getMemoryPool("Metaspace")`. Although metaspace is not baked in the 
>> specification, IMHO it's easier for developers to understand what is 
>> `metaspace` compared to the concepts of `Non Class Space` and `Compressed 
>> Class Space`.
>
>> 
>> If we remove `CompressedClassSpace`, we can only 
>> `getMemoryPool("Metaspace")`. Although metaspace is not baked in the 
>> specification, IMHO it's easier for developers to understand what is 
>> `metaspace` compared to the concepts of `Non Class Space` and `Compressed 
>> Class Space`.
> 
> I personally think that would be totally fine.

> @tstuefe could you take a look at the test changes. Since we can no longer 
> query the compressed class space individually, I think the tests may become 
> more lenient than before. For example, 
> memoryUsageSmallComp/TestDescription.java uses 
> `MemoryUsageTest::checkForNotGrowing()` which monitors the used bytes in 
> `MetaspaceBaseGC::pool.getUsage().getUsed()`
> 
> * Before this PR, it checks that the usage of the compressed klass space 
> doesn't grow.
> * After this PR, it will allow the compresed klass space to grow, as long as 
> the "other" meta space shrinks by a similar amount.
> 
> Is this OK? Or should we add a new whitebox API to query the compressed vs 
> meta space?

Sorry for the long delay, I was not at work.

I think you may be right, we need a replacement for the old memory bean for 
these tests. Whitebox seems easiest.

-------------

PR: https://git.openjdk.org/jdk/pull/8831

Reply via email to