Note that there are some explanatory texts on larger screens.

plurals
  1. POmultithread performance problem for web service call
    primarykey
    data
    text
    <p>Here is my sample program for web service server side and client side. I met with a strnage performance problem, which is, even if I increase the number of threads to call web services, the performance is not improved. At the same time, the CPU/memory/network consumption from performance panel of task manager is low. I am wondering what is the bottleneck and how to improve it?</p> <p>(My test experience, double the number of threads will almost double the total response time)</p> <p>Client side:</p> <pre><code>class Program { static Service1[] clients = null; static Thread[] threads = null; static void ThreadJob (object index) { // query 1000 times for (int i = 0; i &lt; 100; i++) { clients[(int)index].HelloWorld(); } } static void Main(string[] args) { Console.WriteLine("Specify number of threads: "); int number = Int32.Parse(Console.ReadLine()); clients = new Service1[number]; threads = new Thread[number]; for (int i = 0; i &lt; number; i++) { clients [i] = new Service1(); ParameterizedThreadStart starter = new ParameterizedThreadStart(ThreadJob); threads[i] = new Thread(starter); } DateTime begin = DateTime.Now; for (int i = 0; i &lt; number; i++) { threads[i].Start(i); } for (int i = 0; i &lt; number; i++) { threads[i].Join(); } Console.WriteLine("Total elapsed time (s): " + (DateTime.Now - begin).TotalSeconds); return; } } </code></pre> <p>Server side:</p> <pre><code> [WebMethod] public double HelloWorld() { return new Random().NextDouble(); } </code></pre> <p>thanks in advance, George</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload