Concurrent web requests
In the context of concurrent programming, we can see that the process of making a request to a web server and obtaining the returned response is independent of the same procedure for a different web server. This is to say that we could apply concurrency and parallelism to our ping test application to speed up our execution.
In the concurrent ping test applications that we are designing, multiple HTTP requests will be made to the server simultaneously and the corresponding responses will be sent back to our program, as shown in the following diagram:
As we mentioned previously, concurrency and parallelism have significant applications in web development, and most servers nowadays can handle a large number of requests at the same time.
Now, let's see how we can make multiple web requests at the same time, with the help of threading
.
Spawning multiple threads
To apply concurrency...