吞吐量测量

发布于 2024-08-29 20:14:38 字数 890 浏览 7 评论 0原文

我编写了一个简单的负载测试工具来测试Java模块的性能。我面临的一个问题是吞吐量测量算法。测试在多个线程中执行(客户端配置测试应重复多少次),并记录执行时间。因此,当测试完成时,我们有以下历史记录:

4 test executions
2 threads
36ms overall time

- idle
* test execution
       5ms    9ms     4ms      13ms
T1  |-*****-*********-****-*************-|
      3ms  6ms     7ms      11ms
T2  |-***-******-*******-***********-----|
    <-----------------36ms--------------->

目前,我通过以下方式计算吞吐量(每秒):1000/overallTime * threadCount

但有问题。如果一个线程将更快地完成它自己的测试(无论出于何种原因),该怎么办:

      3ms 3ms 3ms 3ms
T1  |-***-***-***-***----------------|
      3ms  6ms     7ms      11ms
T2  |-***-******-*******-***********-|
    <--------------32ms-------------->

在这种情况下,实际吞吐量要好得多,因为测量的吞吐量受以下限制: 最慢的线程。所以,我的问题是如何测量多线程环境中代码执行的吞吐量。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愁杀 2024-09-05 20:14:38

分别为每个线程t分别计算throughput[t] = numberOfTests[t]/overallTime[t],然后计算所有吞吐量的平均值怎么样? >?

然后,您还可以计算范围和标准差等内容,以获得更好的图像。就我个人而言,我非常喜欢箱线图。但仅仅数字本身就很有趣。

How about throughput[t] = numberOfTests[t] / overallTime[t] separately for each thread t, and then calculate the mean of all throughput?

Then you can also calculate things like range and standard deviation to get a better picture. Personally I'm very fond of box plots. But just the numbers themselves would be interesting.

二手情话 2024-09-05 20:14:38

我知道有点晚了,但我有两篇与您的问题相关的博客文章。第一个描述了如何测量吞吐量(以及响应时间)。第二个描述了一种绘制吞吐量图的方法

I know its a bit late, but I have two blog posts associated with your question. The first describes how you measure throughput (and response time). The second describes a way to graph throughput.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文