Let’s say I have some system that coordinates the transfer of many files; that is, I have an Indy TCP server controlling the synchronization of files over a large distributed system.
Currently, in order to send files to specific clients, it requires the locking of the Contexts list on the server.
If I have 500 clients all connected and synchronizations taking place, this locking I suspect would be quite costly on performance as it halts all the client connection threads.
Is there any way to speed this up, or is this not really an issue? Is it worth distributing clients on many servers? What’s the trick?
Cheers,
Adrian
There is no need to lock the Contexts list just to send files. Let the OS handle any file locking for you. When sending a file to a client, have the client open the file in read-only mode. This allows multiple clients to read from the same file at the same time. If a client is uploading a file, open the file in exclusive mode so other clients cannot access the file until the upload is finished.