none
Performance Issue RRS feed

  • Question

  • I have an ASP.NET/C# application. For most of he screens I get data from database, process it and display on grid and other controls. In this whole process, CPU utilization of server goes up to 100% and on an average it remains at 90%. I am using 2.4 GHz, 512 RAM server, Win2000 and IIS 5.

    Which kind of code in C# can cause this kind of problem? What kind of statements in my code I should avoid to avoid high % of CPU utilization. I'll appreciate if anybody can help in this regard.

    Thanks,
    Ashish

    Monday, April 25, 2005 12:43 PM

Answers

  • Hi Ashish,

    In general tight loops cause 100% CPU utilization.
    A while loop or a for loop for example which has lots of processing in it can cause the CPU utilization to touch 100%.

    The use of Thread.Sleep(0) is recommended in loops that maybe causing the issue.
    Specifying zero (0) to indicates that this thread should be suspended to allow other waiting threads to execute.

    Another good option is to use a Code Profiler such as Ants Profiler or the Compuware Profiler and analyze where the issue maybe.

    Regards,
    Vikram
    Monday, April 25, 2005 5:09 PM
    Moderator