Okay so I work on a server application that has multiple communication methods. Including but not limited to WCF, TCP and RESTFUL. These all share information with clients but recently we have been running into issues due to too many clients accessing data. This causes a delay and although we cache as much as we can we would like to look at some way of sharing the load between two servers or possibly more. More importantly if too many clients connect to the same instance it puts strain on some of the other operations running on there, this causes a problem because we are processing real-time data and things need to be done on time.The best solution we could come up with is to create a new program/service that can run on a different server and consume data from the first server and then  clients can connect to that new program/service IP and get the data from there. Although there will be some delay which is okay but in other cases data will have to be shared asynchronously as it's real-time data. I was wondering if there was any way to run the same instance of a program across multiple clients? I am not referring to running the same program in 2 different places, this would cause issues with our data, because we use random numbers etc when generating and processing data. So if we were to run 2 instances of the same program each one would generate different data. Is this possible through running like a virtual machine perhaps? Or is there some library or .NET functionality that can be used to do this more efficiently?NOTE: like I said the instance needs to be the same, 2 different instances would generate different data while clients need to be getting the same data. And although we use SQL at the moment we would not like to replicate the DB, we are moving away from that and creating our own file-based data store as our data has a very limited lifespan and the data itself is very limited.Any pointers will be helpful on how to proceedThanks in advance
Can you create duplicate instances of the same program on different machines asynchronously?
c#;.net;wcf
No. you have the following alternatives1: Remove the random number and refactor your program so that you can run multiple instances at the same time without the data problem you describe. You can then have as many as you like running behind a network load balencer, or pulling from a queue (recommended)2: Add a 3rd shared service to generate the random numbers. Change your program to connect to this service when it needs a number. So that when two instances are running at the same time it allows them to use the same number as required. This 3rd service will be a bottleneck but hopefully generating the number is simple enough that it will not cause delays3: Similar to 2 but instead of a 3rd service allow the instances to talk to each other, syncing up the random number. This can be tricky as network or config problems can lead to an instance thinking it is the only one.The simplest/quickest solution given that you already have a db would be to use this as the 3rd service/communication layer.When one instance needs a random number, have it check  tblRandomNumber to see if there is one already in use. If not create one and update the table with that data.Really though this is a bit hacky and you should refactor as described in solution 1