基准测试:同一过程多次,只有一次预热? [英] Benchmarking : Same process multiple times, only one warmup?

查看:65
本文介绍了基准测试:同一过程多次,只有一次预热?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在研究Java应用程序(基准),该应用程序的目的是确保一些与数据库有关的进程.

I am currently working on a Java application (Benchmark) that has for purpose to mesure some processes relative to a database.

我的应用程序应该运行有以下内容:

My application is supposed to run has following :

我想多次运行多个用例(数据库中的简单插入,简单更新等).运行之间的唯一区别是,同时运行的线程数.

I have several Usecases (simple insert, simple update, etc., in a database) that I would like to run multiple times. The only difference between the runs, would be the number of threads running at the same time.

我需要使用1、2、4、8、16等线程来整理这些用例,以便在我的测试中使用并发性(使用ExecutorService).

I need to bench these usecases using 1, 2, 4, 8, 16, etc.. threads in order to include concurrency in my tests (Using ExecutorService).

我的问题:

我的应用是否需要在每次运行前进行预热?或仅一个就足够了.换句话说,我的应用程序是否必须执行以下操作:

Does my app need to run a warmup before each run ? or only one is sufficient. In other words, does my app has to do the following :

--warmup
--process(1) (1 thread)
--warmup
--process(2) (2 threads)
etc.

OR

--warmup
--process(1)
--process(2)
etc.

基本上,无论线程数量如何,"process()"方法都是完全相同的.我倾向于认为这显然是足够的,因为JVM不会真正优化任何内容,因为代码不会更改.但是,尽管如此,我还是喜欢寻求一些有趣的建议:)

Basically, the "process()" method is exactly the same, regardless of the number of threads. I tend to believe that one is clearly sufficient, as the JVM will not really optimize anything as the code does not change. But, still, I prefer to seek some exerimented advices :)

谢谢您的帮助!

注意:我了解了很多有关基准测试的信息:

Note : I read a lot about benchmarking :

  • http://www.ibm.com/developerworks/library/j-jtp12214/
  • http://www.ibm.com/developerworks/java/library/j-benchmark1/index.html
  • http://www.ibm.com/developerworks/java/library/j-benchmark2/

这就是为什么我要说只需要一次热身的原因. :)

This is why I would say that only one warmup is necessary. :)

推荐答案

需要一个预热.如果您覆盖了这些文章并进行了适当的热身(足够的迭代,确保您的热身代码没有被消除等),那么您的热身就足够了,并且在每次测试之前运行它都不会获得任何额外的好处.

One warmup is needed. If you covered those articles and doing a proper warmup (enough iterations, making sure your warmup code doesn't get eliminated etc.) then your warmup will be sufficient and you won't get any extra benefits of running it prior to each test.

这篇关于基准测试:同一过程多次,只有一次预热?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆