I know that the term βload balancing" can be very broad, but the topic I'm trying to explain is more specific, and I do not know the correct terminology. What I am creating is a set of Server / Client applications. The server should be able to handle huge amounts of data transfer, as well as client connections, so I began to study multithreading.
In essence, there are 3 ways that I can implement the implementation of any type of thread for a server ...
- One thread processing all requests (hits the target of the thread if 500 clients are registered)
- One thread for the user (which is dangerous for creating 1 thread for each of the 500 clients)
- A pool of threads that evenly distributes work for any number of clients (what I'm looking for)
The third is what I would like to know. This consists of the following setting:
- Maximum 250 threads at a time.
- 500 clients will not create 500 threads, but share 250
- The request queue will be sent to the stream.
- The thread is not tied to the client and vice versa
- The server decides which thread to send the request based on activity (load balance)
I'm currently not looking for any code yet, but information on how this setting works, and preferably a tutorial for this in Delphi (XE2). Even the right word or name to put on this topic would be enough for me to do the search myself.
EDIT
I found it necessary to explain a little why it will be used. I will broadcast both commands and images, there will be an installation with two sockets, where there is one "Main Command Socket" and another "Additional routing for streaming images." So really one connection is 2 socket connections.
Each connection to the main server socket creates (or reuses) an object that represents all the data necessary for this connection, including streams, images, settings, etc. For each connection to the main socket, the streaming socket is also associated. This is not always a streaming image, but the command socket is always ready.
The fact is that I already have a streaming mechanism in my current installation (1 stream per session object), and I would like to transfer this to a multi-threaded environment with a pool. These two connections require a higher level of control over these streams, and I cannot rely on something like Indy to maintain synchronization, I would better know how everything works than learn to trust something else to do the job for me .