简体   繁体   English

需要 ASP.Net Smple function,脚本调用任何东西,以在所有 cpu 内核上生成服务器负载

[英]need ASP .Net Smple function, script call anything, to generate load on server on all cpu cores

need ASP.Net Simple function, script call anything, to generate load on server on all cpu cores.需要 ASP.Net Simple function,脚本调用任何东西,以在所有 cpu 内核的服务器上生成负载。 I i want to test IIS cpu limitations based on high cpu (with maximum load), that how server performs.我想测试基于高 cpu(最大负载)的 IIS cpu 限制,即服务器的性能。 but want simplest app to do it.但想要最简单的应用程序来做到这一点。

you can generate load on all CPU cores of a server by using the similar code as below.您可以使用如下类似的代码在服务器的所有 CPU 内核上生成负载。

// Get the number of CPU cores
var cpuCoreCount = Environment.ProcessorCount;

// Start a separate thread for each CPU core
for (int i = 0; i < cpuCoreCount; i++)
{
    var thread = new Thread(() =>
    {
        // Generate load by calculating the sum
        long sum = 0;
        for (int j = 1; j <= 99000000; j++) //just a big number
        {
            sum += j;
        }
    });
    thread.Start();
}

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

相关问题 监视.net应用程序的所有核心的CPU使用情况 - Monitoring CPU usage over all cores for a .net application 在asp.net中动态生成任何滑块 - Dynamically generate anything slider in asp.net 在不使用脚本管理器或页面方法的情况下,从asp.net 2.0中的javascript调用服务器端函数 - Call a server side function from javascript in asp.net 2.0 without using script manager or pagemethods ASP NET 未使用所有可用内核 - Parallel.ForEach - ASP NET not using all available cores - Parallel.ForEach 在Asp.Net中使用Keyup事件调用服务器端功能 - Call Server Side function with Keyup Event in Asp.Net 如何从服务器端ASP.NET调用Javascript函数 - How to call Javascript function from server side asp.net 除了.NET框架之外,在服务器上运行本机Powershell脚本还需要什么? - Anything needed beside .NET framework to run a native powershell script on a server? 我们如何从asp.net服务器端脚本调用客户端脚本? - How do we call client script from asp.net server side script? 如何在asp.net中的page_load()之前从另一个.aspx页面调用函数? - How to call a function from another .aspx page before the page_load() in asp.net? Windows Server / Datacenter:将CPU关联设置为&gt; 64个核心 - Windows Server / Datacenter: set CPU affinity with > 64 cores
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM