How to direct DataSnap client connections to vario

2019-07-04 22:01发布

问题:

I have a quite big DataSnap server that will be running 24/7, it will substitute a currently running MIDAS (COM) server. Now I'm facing the problem of how to update that server without having to force disconnection of all connected clients.

With the current midas server (that, by the way, doesn't have a huge traffic to serve) I simply wait until there are no connections, then shut down the server application and substitute the exe file. If a new connection occurred while the server was "down", being it a COM object, it will be "pulled up" by the OS, giving no problems to the clients.

The new DataSnap architecture isn't anymore based on COM (great!), but this way I lose the opportunity to stop the server without causing new connections to fail.

I've thought that a sort of TCP "proxy" or "tunnel" could solve my problem, so I can simply put a new server exe somewhere and have that "proxy" redirect client connections to the new DS server. I've tried TIdMappedPortTCP, but it continuously hangs at random points of the server-client dialog.

Any ideas?

EDIT: I'm using DataSnap on pure TCP/IP transport for efficiency reasons, so http proxies are not suitable for my specific case.

回答1:

Maybe you should look at the equivalent of a naming service? Could be as simple as a Datasnap server that you make a method call on and returns the IP address of the "main" server. Then when you want to drop a server for maintenance you can change the IP address your naming server is handing out, so new clients get routed to it instead. When your main server is back up, you can change the IP back.

You still have the bootstrap problem (ie. how do they find the IP of the naming server) but this can be as simple as having a couple of IP addresses in a config file on the client and if the first one fails drop back to the second.