多线程.NET程序仅在我的计算机上快速运行 [英] Multi threaded .NET program running fast only on my computer

查看:79
本文介绍了多线程.NET程序仅在我的计算机上快速运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在C#.NET中开发了一个多线程程序,它可以从Web上获取数据。我正在经历的问题是它只能在我的计算机上快速运行,即使在硬件规格较高的机器上也运行缓慢。

速度差异非常大。

在我的电脑上它每分钟达到4000个网址,而在另一个网站上它最多可以达到600个网址。



我使用的是.NET 4.5。任何想法可能是什么问题。

Hi,
I developed a multi-threaded program in C# .NET which brings data from web. The problem I'm going through is that its only running fast on my computer and runs slow even on the machine with higher hardware specifications.
And the difference in speeds is very huge.
On my pc it hits 4000 urls per minute whereas on other it go maximum upto 600 urls.

I have used .NET 4.5. Any idea what can be the problem.

推荐答案

很难从这里确切地指出,但这里有一些想法。



你应该添加一些工具,性能指标 [ ^ ],看看哪里瓶颈是。



它不一定是机器硬件,可能是另一台机器只是孤独地从网址处理数据(即网络速度)。
It's difficult to exactly pin-point from here, but here are some ideas.

You should add some instrumentation, performance counters[^] to see where the bottleneck is.

It's not necessarily the machine hardware and could be that the other machine just take loner to process the data from urls (i.e. network speed).


1.多线程应用程序首先取决于计算机上存在的CPU数量,然后取决于CPU速度和可用内存。



2.因为在每个线程中你都在从互联网上访问网址,你的测试PC的互联网速度也非常重要。


3.您应该使用最佳线程数(不是没有多少线程)并尽快释放使用过的资源。
1.The multi-threading application depends first on the number of CPUs existing on the computer, then on the CPU speed and the available RAM.

2.Because in each thread your are accessing URL from internet, the internet speed of your testing PC is also very important.

3.You should use an optimum number of threads (not no many threads) and to release the used resources as soon as possible.


你在每台PC上运行哪些版本的Windows?



我最近遇到了性能问题,其中2台具有完全相同硬件规格的PC运行高度并行的.NET以极快的速度应用。



快速PC运行的是Windows 7.

慢PC正在运行Windows Server 2012.



Windows Server 2012 PC在应用程序运行时永远不会超过30%的CPU利用率,而Windows 7 PC将以85-90%的CPU利用率运行应用程序。因此,Windows Server 2012需要2.5小时才能运行Windows 7 PC在约1小时内完成的操作。



Windows Server 2012 PC的问题是它有平衡电源选项设置。

一旦设置为性能选项,它的运行速度与Windows 7 PC一样快。这个设置似乎在Windows 7上没有什么区别。



这个修复了它:

http://support.microsoft.com/kb/2207548 [ ^ ]
Which versions of Windows are you running on each PC?

I recently had a performance issue where 2 PCs with EXACT same HW specifications ran a highly parallel .NET application at drastically different speeds.

The "fast" PC was running Windows 7.
The "slow" PC was running Windows Server 2012.

The Windows Server 2012 PC would never get CPU utilization over 30% for the application run while the Windows 7 PC would run the application with 85-90% CPU utilization. So the Windows Server 2012 would take 2.5 hours to run what the Windows 7 PC did in ~1 hour.

The PROBLEM with the Windows Server 2012 PC was that it had "Balanced" Power Options set.
Once this was set to "Performance" option it ran as fast as the Windows 7 PC. This setting doesn't seem to make a difference on Windows 7 though.

This fixed it here:
http://support.microsoft.com/kb/2207548[^]


这篇关于多线程.NET程序仅在我的计算机上快速运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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