Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 718569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:32:31+00:00 2026-05-14T05:32:31+00:00

I’m trying to develop a small application that tests how many requests per second

  • 0

I’m trying to develop a small application that tests how many requests per second my service can support but I think I’m doing something wrong. The service is in an early development stage, but I’d like to have this test handy in order to check from time to time I’m not doing something that decrease the performance. The problem is that I cannot get the web server or the database server go to the 100% of CPU.

I’m using three different computers, in one is the web server (WinSrv Standard 2008 x64 IIS7), in other the database (Win 2K, SQL Server 2005) and the last is my computer (Win7 x64 Ultimate), where I’ll run the test. The computers are connected through a 100 ethernet switch. The request POST is 9 bytes and the response will be 842 bytes.

The test launches several threads, and each thread has a while loop, in each loop it creates a WebRequest object, performs a call, increment a common counter and waits between 1 and 5 milliseconds, then it do it again:

static int counter = 0;

static void Main(string[] args)
{
    ServicePointManager.DefaultConnectionLimit = 250;

    Console.WriteLine("Ready. Press any key...");
    Console.ReadKey();
    Console.WriteLine("Running...");

    string localhost = "localhost";
    string linuxmono = "192.168.1.74";
    string server = "192.168.1.5:8080";

    DateTime start = DateTime.Now;

    Random r = new Random(DateTime.Now.Millisecond);
    for (int i = 0; i < 50; i++)
    {
        new Thread(new ParameterizedThreadStart(Test)).Start(server);
        Thread.Sleep(r.Next(1, 3));
    }

    Thread.Sleep(2000);

    while (true)
    {
        Console.WriteLine("Request per second :"
            + counter / DateTime.Now.Subtract(start).TotalSeconds);
        Thread.Sleep(3000);
    }
}

public static void Test(object ip)
{
    Guid guid = Guid.NewGuid();

    Random r = new Random(DateTime.Now.Millisecond);
    while (true)
    {
        String test = "<lalala/>";
        WebRequest req = WebRequest.Create("http://"
            + (string) ip + "/WebApp/" + guid.ToString()
            + "/Data/Tables=whatever");
        req.Method = "POST";
        req.ContentType = "application/xml";
        req.Credentials = new NetworkCredential("aaa", "aaa","domain");
        byte[] array = Encoding.UTF8.GetBytes(test);
        req.ContentLength = array.Length;
        using (Stream reqStream = req.GetRequestStream())
        {
            reqStream.Write(array, 0, array.Length);
            reqStream.Close();
        }

        using (Stream responseStream = req.GetResponse().GetResponseStream())
        {
            String response = new StreamReader(responseStream).ReadToEnd();
            if (response.Length != 842) Console.Write(" EEEE ");
        }

        Interlocked.Increment(ref counter);

        Thread.Sleep(r.Next(1,5));
    }
}

If I run the test neither of the computers do an excessive CPU usage. Let’s say I get a X requests per second, if I run the console application two times at the same moment, I get X/2 request per second in each one… but still the web server is on 30% of CPU, the database server on 25%…

I’ve tried to remove the Thread.Sleep in the loop, but it doesn’t make a big difference.

I’d like to put the machines to the maximum, to check how may requests per second they can provide. I guessed that I could do it in this way… but apparently I’m missing something here… What is the problem?

Kind regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:32:32+00:00Added an answer on May 14, 2026 at 5:32 am

    There are a lot of limiting factors besides the CPU on a web server. There are a lot of IIS settings which throttle the number of connections can be served.

    I would read this:

    http://www.eggheadcafe.com/articles/20050613.asp

    I know it is for IIS 6, but there are things that will still apply.

    If you have access to MSDN and have VS 2010 ultimate, I would check out their load testing tools. Purchasing the load testing program can be expensive, but if you need to test something specific, you can use the trial version to accomplish what you need. You can use it to monitor and response time, server utilization, etc. Well worth looking into.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 424k
  • Answers 424k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming you're doing something like making an extension and not… May 15, 2026 at 11:50 am
  • Editorial Team
    Editorial Team added an answer I mostly agree with Chris' answer, but I think config… May 15, 2026 at 11:50 am
  • Editorial Team
    Editorial Team added an answer even though "Users" folder does not exist in my computer… May 15, 2026 at 11:50 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.