I need to measure performance of my build method using JMH tool. The build method basically creates multiple threads internally by Completable Future in order to achieve parallel execution for loading an in memory object called dictionary.
However when I am performing benchmarking on the below method:
@Benchmark
public Dictionary buildDictionary() {
DictionaryCreator dictionaryCreator =
new LocalFSDictionaryCreator("metadata_avro_files");
return dictionaryCreator.build();
}
@Benchmarking method is called multiple times on every iterations/Warmup causing "java.lang.OutOfMemoryError : unable to create new native Thread"
What is the best way to achieve JMH on the code which is paralelly processing tasks?