WCF service registration for distrubuted applications
I am开发者_JAVA百科 in the process of designing a client server app that will use WCF to communicate with the client. It is possible it could become heavily loaded and want to design it in a distributed manner. To that end I have split the application into a number of services. N number of services could be running to deal with the requests.
- Login service
- game service
- room service
- etc
The login service would be able to have a load balancer on it. it would then send the request off to one of the game services running, (there could be N game services running on different machines).
What I am trying to figure out is how could the login service know about the game services. I can think of (at a real high level at this point) two solutions:
1) When a game service comes up it creates a record in the database saying who it is and where it is, the login service checks there to find all services. This seems to have problems, services dropping, keeping the list up to date.
2) When a new service joins it contacts a login service, (not sure how that would happen, presume some sort of hard coding on how to find it), and registers with that service. The login service could then maintain a DHT or some list among them so they know where to route the request.
I am new to the whole distributed apps world and trying to figure out a good way of doing things. This project is partly for my own knowledge and gain but also I hope it will progress into a working app.
Thanks
I would think this is the perfect application for a service bus. Let it be the platform on which your services reside. The bus provides a layer of abstraction over the actual physical configuration of your network and it's hosts, allowing for scalability... it's all in the underpinnings.
Using the bus, you can proceed with the pub/sub approach for communicating across services, or more to the point, across business concerns.
I would avoid the database approach in #1 for keeping a manifest of services, instead keeping that information in the running configuration of the bus. With a pub/sub approach, and potentially routing information contained therein, you should be on the right approach.
Have a look at NServiceBus or MassTransit
精彩评论