






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Fan Mao – Sean D. Matthews – Luis L. Perez – Jiangyan Xu
This document gives a brief description of the inter-server communication and coordination protocol that will be used in project #3.
In order to avoid name collision, every server will be named using its IP address and port number. Usernames will be named by concatenating the server IP address and port to the user's desired alias.
Whenever a new server initializes, it must be discovered by some (but not all) of its neighbors. Once the newcomer is discovered, the newcomer and the discoverers must establish a connection through which they can share information about each other, as well as convey messages from other servers to their own neighbors.
When a new server (newcomer) arrives, it broadcasts a welcome message to a pre- determined “broadcast port” on the network. The welcome message should contain a contact address for neighbor requests, and a unique seed so only the servers of that network can become a neighbor.
One server at a time will act as the “external broadcast receiver” for the distributed network.^1 When the broadcast receiver gets the newcomer’s welcome, he sends the appropriate command—along with a counter specifying how many neighbors this newcomer should have, the newcomer’s address, and the unique seed which originated from the newcomer—to his own neighbors, who pass it to their neighbors and so on. The newcomer continues to accept neighbor requests and decrement the counter until the counter reaches zero.
The number of neighbors known to a server should be some function of the estimated size of the distributed network. The function should allow for no more than 2/3 of the network to be neighbors to one server for networks smaller than 6 servers, and ½ of the network for anything greater than or equal to 6 servers. The process for determining the newcomer’s neighbors should not result in a newcomer having more neighbors than specified by this size function.
Each server keeps a record of how many neighbors it has currently. As the newcomer
(^1) This adds to responsibilities that must be transferred if this particular server dies.
announcement comes around, if a server can take on a new neighbor (based on the function for how many neighbors a server should have), it does so. Otherwise, it will check with its neighbors to see if they have any room. If not, it may shed one of its connections with its own neighbors to accept the newcomer as a neighbor, but not before it passes the welcome message to the shed neighbor.
If, after a timeout, the newcomer does not have at least a minimum of neighbors, it will request new neighbors internally.
Operator: [N_Query] Parameter: john 103938439303030….
*Message counter: current counter value for the corresponding neighbors
Operator: [NQ_Response] Parameter: John ip port( or None) End searching ….
*Message counter: current value for this user
There will be a serializable class called QueryMessage, which will contain the appropriate message values such as N_Query and NQ_Response and all the possible parameters and message counters as shown in the images above.
Note: If some requests times out due to the server failure, the requesting server would get the server crash information and also send a message indicating its neighbor searching completed.
A user waits for the response of its server after sending every message, if the waiting time exceeds a certain period of time, it will resend the message. If the response time out for a number of times, say 2, then user considers the server’s been dead.
Timer is set to zero and starts
Is there any new message sent by user?
yes
no
Does the value of timer exceed 10 secs?
no
Send server-detection msg
yes
Does the value of timer exceed 3 secs?
Does the server response?
yes
alive
end
no
no
Time_out+
yes
Time_out<=2?
yes
dead
no
End
Time_out = 0
Timer is set to zero and starts
5. Server recovery
The server recovery process is triggered when a previously existing server is trying to reconstruct its structure, thus reclaiming its previously previously connected users.
In order to achieve successful failure recovery and node reclamation, a server will save its current user list in a temporary file. When a server goes online again after a failure it will try to recall its users.
Firstly, the server will contact the agents directly by sending a special message to their UDP multicast address, asking them to come back to their old chat room. This “invitation” message will be marked with the chat room's original seed to avoid attackers from claiming the users.
After receiving the message, every agent will notify its user that it is coming back to their previous server, so it will leave their current room and move back to the original server. After leaving the chat room, the agent will be notify the server with an acknowledgment message.
The following diagram explains the node reclamation process:
In no particular order, the following information should be passed between communicating servers: