Hello All,
I am writing an HTTP server (TIdHTTPServer) program that services GET requests for images. This 'OnGet' procedure, a procedure of my main form 'Form1', calls other procedures of Form1 to do various tasks, and then finally gets back to the client via TIdHTTPResponseInfo.
I have come to understand that TIdHTTPServer is, by default, multithreaded - that is, whenever someone makes a GET request, and the OnGet procedure is called, a new thread is created just to deal with that one request. However, when I run multiple clients against the server at the same time, the response time significantly slows down. Of course, this could either be the result of what I am doing in those methods (graphics processing), or it could be the result of bad thread considerations on my part. I want to make sure it's not the latter.
So my question is: even though there are multiple threads being spawned to deal with clients, are the procedures that OnGet is calling being executed serially, and thus slowing things down? Do I have to create other threads or do something special to those procedures to make sure multiple occurrences of them can run in parallel, so to speak? Or is there something else I should be looking at here?
If anything needs clarification, please do not hesitate to ask. I need to make my server handle hundreds of clients, and I am seeing significant response-time slowdown after only 3+ connections!
Thanks,
-Tony
I am writing an HTTP server (TIdHTTPServer) program that services GET requests for images. This 'OnGet' procedure, a procedure of my main form 'Form1', calls other procedures of Form1 to do various tasks, and then finally gets back to the client via TIdHTTPResponseInfo.
I have come to understand that TIdHTTPServer is, by default, multithreaded - that is, whenever someone makes a GET request, and the OnGet procedure is called, a new thread is created just to deal with that one request. However, when I run multiple clients against the server at the same time, the response time significantly slows down. Of course, this could either be the result of what I am doing in those methods (graphics processing), or it could be the result of bad thread considerations on my part. I want to make sure it's not the latter.
So my question is: even though there are multiple threads being spawned to deal with clients, are the procedures that OnGet is calling being executed serially, and thus slowing things down? Do I have to create other threads or do something special to those procedures to make sure multiple occurrences of them can run in parallel, so to speak? Or is there something else I should be looking at here?
If anything needs clarification, please do not hesitate to ask. I need to make my server handle hundreds of clients, and I am seeing significant response-time slowdown after only 3+ connections!
Thanks,
-Tony