Sunday, November 8, 2020

Network engineering continued ...

This is a continuation of the earlier posts starting with this one: http://ravinote.blogspot.com/2020/09/best-practice-from-networking.html

P2P can be structured or unstructured.

In a structured topology, the P2P overlay is tightly controlled usually with the help of a distributed hash table (DHT). The location information for the data objects is deterministic as the peers are chosen with identifiers corresponding to the data object's unique key. Content, therefore, goes to specified locations that makes subsequent query easier.

Unstructured P2P is composed of peers joining based on some rules and usually without any knowledge of the topology. In this case, the query is broadcast and peers that have matching content return the data to the originating peer. This is useful for highly replicated items but not appropriate for rare items. In this approach, peers become readily overloaded and the system does not scale when there is a high rate of aggregate queries.

Recently there have been some attempts at standardization on the key-based routing KBR API abstractions and OpenHash - an open publicly DHT service that helps with a unification platform. 

P2P is considered a top-heavy network. Top-heavy means we have an inverted pyramid of layers where the bottom layer is the network layer.  This is the substrate that connects different peers.  The overlay nodes management layer handles the management of these peers in terms of routing, location lookup, and resource discovery. The layer on top of this is the features management layer which involves security management, resource management, reliability, and fault resiliency.

#codingexercise
Trim nodes of a BST that lie outside a range:

Public static Node trim(Node root, int low, int high) { 

if (root == null) return root; 

root.left = Trim(root.left, low, high); 

root.right = Trim(Root.right, low, high); 

if (root.data < low || root.data > high) { 

    // both root.left and root.right cannot be present in this case. 

    If (root.right != null) return root.right; 

    If (root.left != null) return root.left; 

    Return null; 

} 

return root; 

 

No comments:

Post a Comment