All Questions
Tagged with jmh multithreading
14
questions
0
votes
0
answers
61
views
JMH microbenchmarking on java api which uses parallel execution via Completable Future
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 ...
0
votes
0
answers
356
views
Why ExecutorService is much faster than Coroutines in this example? [Solved]
Update:
I made 2 silly mistakes!
I submitted only 1 task in the executor service example
I forgot to await for the tasks to finish.
Fixing the test, lead to all 3 examples having around 190-200 ms/...
0
votes
3
answers
459
views
CPU costs of Thread.sleep() and Thread.onSpinWait()
I'm running two benchmarks in order to compare costs of Thread.sleep() and Thread.onSpinWait():
@State(Scope.Thread)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public ...
0
votes
1
answer
254
views
Costs of Thread.sleep(1) are different depending on busy-loop implementation
Suppose we execute Thread.sleep(1) within a loop iterating n times (here and below it's Java 11):
@State(Scope.Thread)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(...
1
vote
4
answers
2k
views
JMH - How to correctly benchmark Thread Pools?
Please, read the newest EDIT of this question.
Issue: I need to write a correct benchmark to compare a different work using different Thread Pool realizations (also from external libraries) using ...
0
votes
1
answer
383
views
Java JMH run method with multiple parameters
I am trying to performance test a web app under load. I want to increase the number of users to check how that will affect the system's behavior. I intend to use JMH wit Java. I have already written ...
0
votes
1
answer
322
views
Runtime discrepancy when using CompletableFuture on an IO bound task
My understanding of the JVM multi-threading model is that when a thread executes an IO call, the thread is BLOCKED and put into a waiting queue by the JVM/OS until data is available.
I am trying to ...
2
votes
0
answers
191
views
Benchmarking a lock-free stack with Java and JMH
For one of my university courses I'm required to implement a lock-free stack implementation, and perform benchmarks on it to see how it scales with respect to thread count and operation distribution. ...
0
votes
1
answer
65
views
The value is not taken from the dictionary in JMH when thread is 2?
For a JMH class, Thread number is limited to 1 via @Threads(1).
However, when I get the number of threads using Thread.activeCount(), it shows that there are 2 threads.
The simplified version of ...
1
vote
1
answer
401
views
Using AtomicInteger with JMH multi-thread?
I am using JMH to test some features of my project. When I try to use it's @GroupThreads with AtomicInteger, I cannot reset the AtomicInteger, it just increases over time. I also tried with if else to ...
1
vote
0
answers
339
views
Benchmarking Multi-threaded Collections in Java
I'm using JMH to measure average-time spent in Collections.
As I was trying to achieve multithreaded add, get and remove I wanted to be sure that the operations are correctly written to use such ...
5
votes
1
answer
1k
views
Java lock-free performance JMH
I have a JMH multi-thread test:
@State(Scope.Benchmark)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@Fork(value = 1, jvmArgsAppend = { "-Xmx512m", "-server", "-XX:+...
2
votes
1
answer
255
views
Error benchmarking multithreaded algorithm using parameterized 'jmh' measurement
For benchmarking a multithreaded algorithm, I set up a parameterized jmh measurement. After quite some time, the measurement crashes with the error
java.lang.OutOfMemoryError: unable to create new ...
3
votes
1
answer
5k
views
Performance of ReentrantReadWriteLock read lock?
I have some storage similar to a map. I have been using synchronized(this) for get and put methods. Since this storage is mostly used for reading, I thought of using ReentrantReadWriteLock for better ...