System Design for FailOver Server
Sorry I can't type in Chinese here. We can discuss in English or Chinese. It doesn't matter.I'm working on a system design for failover servers, and I choose the standby mechanism,
which might be the most simple system for it. It means that there would be a server called
master, and another server called standby. Usually, the master server serves on a specific
port to handle all the transaction with clients. The master server is also in charge of
synchronizing configuration and data with the secondary server, which works in a standby
mode. These two servers know status of each other by sending heartbeat message back and forth
between them. When the standby server notices that the master one fails to response it,
the standby server will take the control of the communication and work temporarily as a
master server, until another master server boots up and failbacks from the secondary.
For the client side, all clients will be configured with two server's address (ip or port, etc).
They will try to communicate with the master first and then the secondary if the master fails
to response to them. If they are talking to the secondary one and the master comes back to alive,
they will receive message from the master and turn back to the master accordingly. Since all data
will be synchronized between these two server as fast as possible, and I will try to make
the transaction as short as possible, I assume everything will keep on working very well regardless
the failover and failback transfer. There would be some complicated situations, but currently I
only want to focus on the basic design.
That's all the requirement I need to meet. 和我上学时设计的client server聊天室惊人的相同,俺设计的也是双server They will be three kinds of server due to the current system requirements.
I call them as A-Server, B-Server, and C-Server. I expect there will be more
in the future; therefore, my design should support the server type extension
easily.
Please take a look at the above picture, where I depict my system design.
There will be a Factory interface, which response for the creation of
its corespondent type of Server. For example, there will be AFactory class
which will be responsible to create A-Server, and BFactory and CFactory,
and so forth.
I don't want to hard code the possible Factory list into my system; therefore,
I would like to apply the Service provider concept here. It means that I will
place a service description file within META-INF/service directory, where
a Factory class name will be found. My developer just needs to implement their
own Server type and its Factory and pack them up with a service description.
When I deploy such a package, which usually is a JAR file, the system will
find the Factory easily.
I would also introduce a URL for this system. The URL might have a format as:
<companyname>:<master|standby>:<host>:<port>//<service type>/<other parameters>
My factories would work in a chain-of-responsibilities mode, which parse the
URL one-by-one, till someone says, OK, it's mind.
OK, that's all of my though currently. Let's discuss it in more details.
Thanks. What I'm thinking about is a Failover framework, based on which,
my developers could implement their own servers easily without
any burden with failover or standby mechanism. They will program
a normal server with some special interfaces, such
1. Configuration synchronizing interface including both sending
and receiving sides.
2. Other data synchronizing interfaces
3. Failover control on the standby server
4. Failback control on the master server
5. Heartbeat message communication implementation
6. Reporting interface, used when the other server is unreachable.
Obviously, as a framework, I won't really care about the detail
implementation of the configuration item transmitting between
these two servers; I don't even consider the synchronizing mechanism
applied on them. I just need to make sure they know what duties they
are assigned to be a master or standby server.
On the other hand, I'm responsible for providing the infrastructure
supporting the failover implementation. That means, I should
introduce a list of the components for that suppose, and tell
everybody, hey mate, don't worry, please apply these components
on they implementation until you want a custom solution.
页:
[1]