简体   繁体   English

为什么多线程Java程序在“超级”Linux服务器和笔记本电脑Win7上的速度不快?

[英]Why is multithreaded Java Program not faster on 'super' Linux server vs laptop Win7?

Intro 介绍

So far, I have been working on a piece of software which I am now testing to see the benefit of concurrency. 到目前为止,我一直在研究一个软件,我现在正在测试它以了解并发的好处。 I am testing the same software using two different systems: 我正在使用两个不同的系统测试相同的软件

  • System 1: 2 x Intel(R) Xeon(R) CPU E5-2665 @ 2.40GHz with a total of 16 cores , 64GB of RAM running on Scientific LINUX 6.1 and JAVA SE Runtime Enviroment (build 1.7.0_11-b21). 系统1:2 x Intel(R)Xeon(R)CPU E5-2665 @ 2.40GHz,共有16个内核,64GB RAM在Scientific LINUX 6.1和JAVA SE Runtime Enviroment(build 1.7.0_11-b21)上运行。
  • System 2 Lenovo Thinkpad T410 with Intel i5 processor @ 2.67GHz with 4 cores, 4GB of ram running windows 7 64-bit and JAVA SE Runtime Enviroment (build 1.7.0_11-b21). 系统2联想Thinkpad T410采用英特尔i5处理器@ 2.67GHz,4核,4GB内存运行Windows 7 64位和JAVA SE运行时环境(版本1.7.0_11-b21)。

Details: The program simulates patients with type 1 diabetes. 详情:该计划模拟1型糖尿病患者。 It does some import (read from csv), some numerical computations(Dopri54 + newton) and some export (Write to csv). 它做了一些导入(从csv读取),一些数值计算(Dopri54 +牛顿)和一些导出(写入csv)。

I have exclusive rights to the server, so there should be no noise at all. 我拥有服务器的专有权,所以根本就没有噪音。

Results These are my results: 结果这些是我的结果:

S1

S2

Now as you can see system 1 is just as fast as system 2 despite it is a pretty powerfull machine. 现在你可以看到系统1和系统2一样快,尽管它是一台非常强大的机器。 I have no idea why this is the case - and I am confident that the system is the same. 我不知道为什么会这样 - 我相信系统是一样的。 The number of threads goes from 10-100. 线程数从10到100。

Question: 题:

Why would does the two runs have similar execution time despite system 1 being significantly more powerfull than system 2? 尽管系统1比系统2强大得多,但为什么两次运行的执行时间相似?

UPDATE! UPDATE!

Now, I just thought a bit about what you guys said about it being an I/O memory issue. 现在,我只是想一下你们所说的关于它是I / O内存问题的内容。 So, I thought that if I could reduce the file size it would speed up the program, right? 所以,我认为如果我可以减小文件大小,它会加快程序,对吧? I managed to reduce the import file size with a factor of 5, however, no performance improvement at all. 我设法将导入文件大小减少了5倍,但是根本没有性能提升。 Do you guys still think it is the same problem? 你们还认为这是同样的问题吗?

当您编写.csv文件时,瓶颈可能不是您的换档能力,而是硬盘上的写入速率。

Almost certainly this means that either CPU time is not the bottleneck for this application, or that something about it is making it resistant to effective parallelization, or both. 几乎可以肯定,这意味着CPU时间不是这个应用程序的瓶颈,或者它的某些东西使它无法有效并行化,或两者兼而有之。

For example if reading the data from disk is actually the limiting factor then faster disks are what matters, not faster processors. 例如,如果从磁盘读取数据实际上是限制因素,则更快的磁盘是重要的,而不是更快的处理器。

If it's running out of memory then that will be a bigger bottlneck. 如果它的内存不足那么那将是一个更大的瓶颈。

If it takes more time to spawn each thread than the actual processing inside the thread. 如果生成每个线程所需的时间比线程内的实际处理要多。

etc. 等等

In this sort of optimization work metrics are king. 在这种优化工作中,指标是最重要的。 You need real hard solid numbers for how long things are taking, and where in your program you are losing that time. 你需要真正坚实的数字来确定事情的持续时间,以及你的计划在哪些地方失去了那段时间。 Only then can you see where to focus your efforts and see if they are effective. 只有这样,你才能看到在哪里集中精力,看看它们是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM