C#Windows应用程序。 Windows 7和Windows Server 2016之间的不同性能 [英] C# Windows App. Different Performance between Windows 7 and Windows Server 2016

查看:280
本文介绍了C#Windows应用程序。 Windows 7和Windows Server 2016之间的不同性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我在C#.NET 4.7中开发了一个Windows窗体应用程序。我在使用Windows 7 Pro作为操作系统的vmware虚拟机中测试了它,并在使用Windows Server 2016作为操作系统的虚拟机的主机中进行了测试。在Windows 7虚拟机中,
应用程序占用CPU的所有核心,并且任务运行速度比主机快。在具有Windows Server的主机中,应用程序仅使用16个核心CPU中的两个核心,并且任务比虚拟机中运行的速度慢。我认为在主机中它会更快,但事实并非如此。为什么主机(Windows服务器2016)中的应用程序比虚拟机(Windows 7 Pro)中的应用程序慢?如果应用程序是相同的,为什么应用程序不会使CPU的所有核心运行得更快?

I have developed a Windows Forms app in C# .NET 4.7. I have tested it in a vmware virtual machine with Windows 7 Pro as operating system, and in the host of that virtual machine with Windows Server 2016 as operating system. In the Windows 7 virtual machine, the app takes all the cores of the CPU and the tasks run faster than in the host. In the host with Windows Server, the app uses takes only two cores of the 16 cores CPU and the tasks run slower than in the virtual machine. I thought that in the host it will be faster, but it isn't. Why the app is slower in the host (Windows server 2016) than in the virtual machine (Windows 7 Pro)? Why the app doesn't take all the cores of the CPU to run faster if the app is the same?

谢谢。

推荐答案

我不相信这与Server 2016有任何关系。如果你做了很多IO,VM可能比物理机更快,因为IO是虚拟化的,所以你不是实际上还在等硬件。许多应用程序在VM环境中运行得更快。

I don't believe this has anything to do with Server 2016. A VM can be faster than a physical machine if you are doing a lot of IO because the IO is virtualized so you aren't actually waiting for the hardware. Many apps run faster in a VM environment.

至于内核,我想知道您的VM配置是否正确。配置VM时,必须指定它获得的处理器数量,无论是虚拟还是物理和其他特征。我的直觉是,你的应用程序根本不需要所有处理器,或者你没有配置VM来全部使用它们。您应该让管理员查看您的VM配置,以确保其设置正确。假设它是,如果你的应用程序有足够的
线程运行,VM将使用所有可用的处理器。

As for the cores, I wonder if your VM isn't configured properly. When you configure a VM you have to specify how many processors it gets, whether they are virtual or physical and other characteristics. My gut instinct is that either your app simply doesn't need all the processors or you haven't configured the VM to use them all. You should probably have your admin staff look at your VM configuration to make sure it is set up properly. Assuming it is, the VM will use all available processors if your app has enough threads running.

这与C#或.NET没有任何关系我相信。我认为您应该将它发布在TechNet论坛(适用于Hyper-V)或VMWare论坛(适用于VMWare)。我认为这是一个虚拟机问题。

This doesn't really have anything to do with C# or .NET I believe. I think you should post it in the TechNet forums (for Hyper-V) or the VMWare forums (for VMWare). I think it is a VM issue.


这篇关于C#Windows应用程序。 Windows 7和Windows Server 2016之间的不同性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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