In the last post(http://java.dzone.com/articles/how-make-distributed-system), we talked about the conception how to make distributed system auto-scalable.
It will be a design pattern for distributed system in auto-scalability. The following is 2 examples to explain it.
1st, Game Platform of Internet
Game Platform provider many types of game for users by a game portal.
Users can login and play many games in the game platform by Game Client.
Users select one type of game from the portal and enter the game hall, and after selecting a game room in the game hall Users can choose a desk and sit down and begin game (with other users).
In this scenarios, we hope the game portal node and game hall node and game room node can be auto-scalable for failure-tolerant and
adding new node when users access is rising and reducing node when users access is lower .So those node should be added or removed transparently.
At client side, Users download Game Client software (a GUI application) and install it, and then use Game client software to access the Game Platform and play game.
At Server side, there are Login Server and Game Hall Server and Room Server to serve the Game Client.
The Login Server plays an entry point role in this scenarios. It provides login function and sends a suitable Game Portal Node information (according theirs health) to the game Client.
Game Portal plays a Gateway node role(router) for Game Hall nodes in the system , and Game Hall plays a Gateway node role for Game Room nodes.
According to theabove we can know ,Game portal nodes and Game Hall Node and Game room nodes can be remove or add transparently in the system ,
and our system is auto-scalable. But the login server is not auto-scalable ,We will talk it in the next post.
2sd, Search as a Service
There are many search engine nodes(almost 100 instances ) and many client applications(hundred of apps ,thousands of app instances) which will access the search engines .
Also ,there are many services deployed in the service platform. So the client applications can access the service platform without any thing about search engine.
As we can see from the following picture, there will be 5 logic roles in the system, client apps\service master nodes\service nodes\search engine\Register Server nodes.
Client apps send search requests to the Service master node. Service master node routes the request to a Service node(which it's on a health status) to execute the request and send back the service result.
At last, the service node request a suitable search engine(search engine node information is stored in DB by other application) to execute the search request.
As described in the above picture, if Service Node is added or removed from the system, the master nodes can monitor the change of service nodes .
If a service node is added, the master nodes know there is a new service node, and put the new service node to service node route list, then if there are new service request, the master node can route the request to the fresh service node.
If the service node is removed, the master nodes also can know there is a service node is down , and the master nodes remove the unavailable service node from the route list .
So the system is gracefully handled the change of service node, and the service node is added or removed transparently .
From the examples , we know Distributed system can use the pattern(register and monitor) to improve the system Quality on system modifiability. We will talk about node elastic in next post.