Throughput measurements
        Posted  
        
            by dotsid
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by dotsid
        
        
        
        Published on 2010-04-21T09:29:29Z
        Indexed on 
            2010/04/21
            9:33 UTC
        
        
        Read the original article
        Hit count: 398
        
theory
|load-testing
I wrote simple load testing tool for testing performance of Java modules. One problem I faced is algorithm of throughput measurements. Tests are executed in several thread (client configure how much times test should be repeated), and execution time is logged. So, when tests are finished we have following history:
4 test executions
2 threads
36ms overall time
- idle
* test execution
       5ms    9ms     4ms      13ms
T1  |-*****-*********-****-*************-|
      3ms  6ms     7ms      11ms
T2  |-***-******-*******-***********-----|
    <-----------------36ms--------------->
For the moment I calculate throughput (per second) in a following way: 1000 / overallTime * threadCount.
But there is problem. What if one thread will complete it's own tests more quickly (for whatever reason):
      3ms 3ms 3ms 3ms
T1  |-***-***-***-***----------------|
      3ms  6ms     7ms      11ms
T2  |-***-******-*******-***********-|
    <--------------32ms-------------->
In this case actual throughput is much better because of measured throughput is bounded by the most slow thread. So, my question is how should I measure throughput of code execution in multithreaded environment.
© Stack Overflow or respective owner