Hey all. I am completely stuck here. I want to implement a round robin based service capable of load balancing http requests.
ATM I have a thread with an infinite loop which listens for TCP connections. When it finds a connection, it runs another thread which will process the request.
I guess I'm just not sure what way round robin is supposed to actually be implemented, I understand that it should pass each new connection request to the next server in line, eventually distributing connections evenly across the array of machines being load balanced.
But I don't know how I go about it. Do I create a new webserver each time I find a connection? If I am already running a thread that is processing a HTTP request, what the hell is the point of creating more servers when the program will have to wait for the thread to finish anyway?
Pseudo-code would be a big help for this.