I ended up coding a java application that uses 25 different threads, each thread is an infinite loop into which the HTTP request is sent, and the json (small one) object that is returned is processed. It is imperative that the time between two requests sent by a particular thread is less than 500 ms. However, I made some benchmark in my program, and this time is much more than 1000 ms. SO my question is: is there a better way to handle multiple connections besides creating multiple threads? I am in desperate need of help, so I am grateful for any advice you may have!
PS: I have a decent internet connection (my ping to the target request server is about 120 ms).
source share