Docsity

Protocol Description - Project 3 | COP 5615, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
COP5615 Project #3 – Protocol Description
Fan Mao – Sean D. Matthews – Luis L. Perez – Jiangyan Xu
Summary
This document gives a brief description of the inter-server communication and
coordination protocol that will be used in project #3.
1. Server and username naming
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.
2. Neighbor discovery
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.
2.1. Mechanisms
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.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Protocol Description - Project 3 | COP 5615 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

COP5615 Project #3 – Protocol Description

Fan Mao – Sean D. Matthews – Luis L. Perez – Jiangyan Xu

Summary

This document gives a brief description of the inter-server communication and coordination protocol that will be used in project #3.

1. Server and username naming

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.

2. Neighbor discovery

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.

2.1. Mechanisms

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.

  1. User receives the message from its server, lists if there’s a John has been found and check whether there might be more from the in searching parameter.
  2. Those neighbors recursively send this message to their neighbors other than the one who sent this message to it and collect responses only from whom it sent message to. If some of them receives the searching request with the same person and random number, which shows it’s a duplicate one then stop propagating that message and re- ply a empty message (means some one has already got the result) to the sender. Ev- ery server will response to its neighbor using the same format as the first server. Once it gets all responses, it generates this message and send it to the one who first sent this request to it:
  3. Recursively, when the original server of the user gets all responses, it also sends the above message to that user, which means the whole reachable network has been tra- versed. Then this process ends.

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

3.2. Message format

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.

3.3. Additional notes

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.

5.1. Mechanisms

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:

  1. Message format

In no particular order, the following information should be passed between communicating servers:

represents the destination IP/hostname and port number of the recipient of the message. , similarly, represents the IP/hostname and port number of the message sender. is an object which a server can “tick” to note that it has received this message. As the message is passed around, this will prevent duplicate receipts. represents a special code which servers use to interpret what type of message they are receiving and how they should handle the messages’s contents, especially the . carries all information specific to some error, command, or other .