When I click "Perform GC" button in JVisualVM, the classes are unloaded and the throughput is reached.
So i think it would help if I could indicate when the GC should happen,
for example when the total number of loaded class reach certain number.
I tried -XX:MetaspaceSize=120M but it didn't trigger class unload when the metaspace usage reached 120MB.
-XX:MaxMetaspaceFreeRatio=30 -XX:MinMetaspaceFreeRatio=10 should cause it to fill up quickly and thus trigger class-unloading GCs.
-XX:+ExplicitGCInvokesConcurrent -XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses and using CMS or G1 and firing
System.gc() via a timer might work too.