1

Am using plain webBroker Delphi 10.4.1

I have a server that accepts a Json String. I parse it and send the same data back (for simplicity sake) to the client.

My assumption is Webbroker has default 32 threads (web module instances) that will be created on the server - progressively, as concurrent client requests start hitting the server and stop at 32 (refer web.webreq.pas)

To test this scenario I have created a simple Client program that has a For-loop that will keep firing at the the server with a request that will carry a JSon String.

For 10,000 requests it takes about 14 seconds. Only ONE instance of the webModule gets created...which is fine because the for loop sends the request in a serial fashion in an SYNCHRONOUS mode.

When I run another (parallel) instance of the client program, the 2nd instance of the WebModule gets created....fair enough. When I run one more parallel instance of the client, the 3rd instance of the WebModule gets created....so on and so forth

Now is the interesting part....

Remember the time taken for 10K request which is 14 seconds when only my first Client program was running? As I increase the number of concurrent clients, the time taken to process also increases

If the Server was truly Multi-threaded as claimed, then at least up to 32 concurrent client requests the time taken should be the SAME to process individual 10K records from each client, right? That is in 14 seconds all 3 client program requests (amounting to a total of 30K requests) must have been completed. It takes thrice the time roughly about 42 seconds

Can someone pls clarify if Web Broker is truly Multi-threaded? And if so what is it I am missing?

  • 2
    The dispatcher is likely serial and since you are doing no actual work in each request that is what you end up benchmarking. Soon as you do any work for each request the time taken in the dispatcher becomes insignificant. – Brian Nov 30 '20 at 14:31
  • How many cpus/cores does your PC have (I suspect at least 2). But when you have multiple threads fired at once, the time taken to handle them will increase as there will be some context switching between the threads as only that many threads can run as cpu cores are available. But when you let each call take a bit longer (ex 0.5 sec delay) the result will probably be getting different... – R. Hoek Dec 01 '20 at 20:12
  • Thank you Brian and Hoek. I added a delay of 100 ms as part of my test case and yes I find a lot of improvement in the results. I shall now boldly go ahead and start coding my server – Ganesh Padmanabhan Dec 02 '20 at 05:24

0 Answers0