<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Asaf Kozovsky on Medium]]></title>
        <description><![CDATA[Stories by Asaf Kozovsky on Medium]]></description>
        <link>https://medium.com/@asafkozovsky?source=rss-8b853fcbe35c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p7OLy5w7c7vXtBDyUWpxUQ.jpeg</url>
            <title>Stories by Asaf Kozovsky on Medium</title>
            <link>https://medium.com/@asafkozovsky?source=rss-8b853fcbe35c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:18:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asafkozovsky/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Routing in structured P2P networks]]></title>
            <link>https://medium.com/@asafkozovsky/routing-in-structured-p2p-networks-fed7e584879f?source=rss-8b853fcbe35c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fed7e584879f</guid>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[dht]]></category>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <category><![CDATA[distributed-hash-table]]></category>
            <dc:creator><![CDATA[Asaf Kozovsky]]></dc:creator>
            <pubDate>Wed, 04 Oct 2023 20:36:18 GMT</pubDate>
            <atom:updated>2023-10-04T20:36:18.559Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this discussion we will take a closer look at how structured P2P networks (specifically ring DHTs) tackle the problem of distributed query routing.</h4><p><em>This is the third post of a </em><a href="https://medium.com/@asafkozovsky/open-permissionless-p2p-networks-9e31e52703fa"><em>multipart series</em></a><em> about P2P networks.</em></p><p>At the heart of every P2P network lies its routing protocol, this protocol is what turns an assortment of nodes, each one oblivious to the existence of any peer not directly connected to it, into a functioning system that can reach global scale.</p><p>Structured networks solve this problem by enforcing strict rules about node connectivity. These rules are what defines the network’s underlying topology which simplify lookup logic. In the previous part we mentioned that nodes in a structured network are assigned identifiers, these identifiers are commonly hashed values, this facilitates even distribution across the ID space. Data stored on structured networks share the same ID space as nodes. Data is stored on nodes which have the “closest” identifier, making homogenic ID distribution extremely important because it directly affects storage loads. Each node also stores information for connecting to a small subset of other nodes in the network in what is called a “<strong>Routing Table</strong>”. The implementation for routing tables would vary based on the topology, but all share a common principle — they enable nodes to identify the peer closest to any given ID. If the peer has the data it will route it back to the query originator, if not, it will route the query to the closest node it has on its routing table, this routing process would continue recursively until the node which has the data is found. Let’s examine the way routing is executed in a DHT (Distributed Hash Table) with a ring topology since it is one of the simpler topologies for a structured P2P network. We will start with a simplified example to provide some intuition, and then proceed to make a more complex and elaborate one.</p><p>In the simple example the ring is neatly ordered across a 4 bit ID space (0–15) similar to the example in the previous part. A data point which has an ID of 12 would be located on node 12 since it is the closest one to it. In a classical ring topology if no node matches the ID exactly, the node with the closest lower or higher ID is designated to store the data. For example, if the rule was “closest lower” and nodes 12, 11 and 10 were missing, the data point with ID 12 would be stored on node 9. If the rule was “closest higher” that data point would have been stored on 13. When nodes are added or removed from the network the closest node to any given data point might change, necessitating changes to the data store. When a new node is added it will be assigned some of the data from an existing node. When nodes leave gracefully they can assign their data to other nodes as well. Ungraceful exists (like failures) are mitigated mostly through replication. This technique is also called “<strong>Consistent Hashing</strong>”.</p><p>As discussed in the previous part, nodes in the ring topology have shortcuts (also called “finger tables”) to other nodes. These tables are populated by the following calculation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*pVvbXL7SjVMdjbZ_7lYyhA.png" /></figure><p>where m is the ID space and <strong><em>i</em></strong> can have values of 0 to <strong><em>m — 1</em></strong>. This means node 0 would have nodes 1, 2, 4 and 8 in its routing table. Similarly node 8’s routing table would contain 9, 10, 12 and 0.</p><figure><img alt="A simple diagram of a ring DHT with a 4 bit ID space with nodes homogenously dispersed." src="https://cdn-images-1.medium.com/max/707/1*fHCkrYla9AkXt6j02f9ebQ.png" /><figcaption>A simple ring DHT (Image made by the author using excalidraw.com)</figcaption></figure><p>If node 0 would need to query the data entry with ID 12 it will not find a node with a matching ID in its routing table, so it will route the request to the closest lower ID node, in this case node 8. Because node 12 would be in node 8’s routing table (8 + 2² mod 16 = 12) node 8 will route the query directly to it. Node 12 will find that it stores the queried data and will route the request directly back to node 0. Node 12 would not have to look for node 0 in its routing tables because the query originator would send its contact information (IP address and port) along with the query.</p><p>This example was fairly straight forward, but in real world scenarios where there are a multitude of nodes randomly distributed on a vast ID space, things rarely look so neat.</p><p>For the more complex example let’s imagine a ring network composed of 27 nodes and 1 data entry randomly dispersed on an 8 bit (0–255) ID space:</p><figure><img alt="A complex diagram of a ring DHT with 27 nodes dispersed unevenly on an 8 bit ID space." src="https://cdn-images-1.medium.com/max/668/1*ee4KR3JsSgVdB89F8XU9qA.png" /><figcaption>A complex ring DHT (Image made by the author using excalidraw.com)</figcaption></figure><p>We used random numbers instead of hash values for simplicity. Notice the distribution of IDs is not very homogenous, this is because the ID space and the node amount is still really small. Higher numbers would make the example much too complex though.</p><p>Because we have chosen the “closest lower” rule, the data point with ID 118 is stored on the node with ID 117. This would have been true also if the ID was 119 because node 120 has a higher ID.</p><p>Now let’s assume node 1 needs to query this data point. Because it isn’t the node storing the data it will try to route the query to another node using its routing table. The routing table will contain nodes 5, 16, 21, 44, 65 and 131. This is how it’s routing table would look like (Please note that we do not delete the extra entries leading to same nodes for the sake of coherence):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*2gzcrta_EfM4rTg9w3HtRg.png" /><figcaption>Node 1’s routing table</figcaption></figure><p>Looking at the table it’s clear that the closest lower node that node 1 is aware of is node 65. When the query reaches node 65 it checks to see if it has the data, and when it discovers it doesn’t, it routes the query using it’s routing table as well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*Q2aES8elJmcnaNSKNxhfBw.png" /><figcaption>Node 65’s routing table</figcaption></figure><p>The closest lower node in this case is node 107, which does the same as the previous two:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*dgqytreZzU0yV-Hvojnerg.png" /><figcaption>Node 107’s routing table</figcaption></figure><p>The query would be routed to node 117. Because this node would find that it in fact stores the queried data, it will proceed to route it back to node 1.</p><figure><img alt="Routing in a ring DHT with an 8 bit ID space, 27 nodes and 1 data point." src="https://cdn-images-1.medium.com/max/668/1*UFaQ1lsNYVs9n02h7jKeBA.gif" /><figcaption>Example of how the routing on our DHT would take place (Gif by author using excalidraw.com and ezgif.com)</figcaption></figure><p>So far we covered how a data point might be routed to in a structured P2P network, but what happens if the data queried is not found on the network at all? The most straightforward way to conclude the data is unavailable is if the nodes that are supposed to have it return a “not found” response. Consider the network from the previous example, if node 117 did not have the data it would not route the query to node 120 since its ID is higher than that of the data. It would conclude the data is not available and send a response back. But if 117 was down, node 107 would not get any response from it, it might make a few retries, but if the node would not respond it might try a different strategy. Because nodes only know about peers in their routing table, node 107 would not know if there is a closer node than 117 (like a node with ID 118) so it can not conclude the data is not on the network. In the event of failure nodes might try falling back and routing the request to another close node, like 112 in our example. These failures and fallbacks could happen anywhere along the route. For an extremely large route with multiple failures this could be a very expensive process. To mitigate the cost, some DHTs would implement some kind of TTL mechanism to put a limit on the number of hops a query would be routed. This strategy however would also make a “not found” response probabilistic.</p><p>Other topologies routing mechanisms would be explored on the post dedicated to DHTs.</p><p>Please stay tuned for the next post where we will discuss routing in unstructured P2P networks.</p><p>This post was reviewed by <a href="https://www.linkedin.com/in/eran-asseo/">Eran Asseo</a>, A software engineer with a passion for distributed systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fed7e584879f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure and Topology in P2P Networks]]></title>
            <link>https://medium.com/@asafkozovsky/structure-and-topology-in-p2p-networks-c3d4d28e570e?source=rss-8b853fcbe35c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3d4d28e570e</guid>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[distributed-hash-table]]></category>
            <category><![CDATA[dht]]></category>
            <dc:creator><![CDATA[Asaf Kozovsky]]></dc:creator>
            <pubDate>Tue, 26 Sep 2023 18:37:28 GMT</pubDate>
            <atom:updated>2023-10-04T20:37:40.167Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this discussion we will examine the different structural types of peer to peer networks. We will also take a closer look at some of the topologies structured networks can have.</h4><p><em>This is the second post of a </em><a href="https://medium.com/@asafkozovsky/open-permissionless-p2p-networks-9e31e52703fa"><em>multipart series</em></a><em> about P2P networks.</em></p><h3>Overlay</h3><p>P2P networks generally come in two flavors: Structured and Unstructured.</p><p>In <strong>Structured </strong>P2P networks nodes have rules about which peers they are connected to and which parts of the network’s state is assigned to them. This generally means the network will be more efficient since nodes have an easier time finding each other as well as routing requests and responses properly. The trade off is less node autonomy in optimizing its own number of connections and deciding which peers to form connections with. This kind of network overly tends to perform less optimally under high churn, since adding or removing nodes can cause far reaching structural changes. A common use case of structured P2P networks are Distributed Hash Tables (DHTs).</p><figure><img alt="An example of a structured network overlay also called a dimensional mesh" src="https://cdn-images-1.medium.com/max/551/1*zYNJl8ctRQZyLlVWWvgXxg.png" /><figcaption>A structured network (Image made by the author using excalidraw.com)</figcaption></figure><p>In <strong>Unstructured </strong>P2P networks peers can connect to any peer of their choosing and form as many connections as they can maintain. This structure is optimal when churn is high, but it also makes routing requests and responses much more complex and latent, since peers have no way of knowing in advance where the destination is located. This trait is even more pronounced when peers are trying to locate missing nodes or data. Certainty for missing data can’t be achieved without the costly endeavor of querying every node in the network. Costs are compounded because nodes might be queried multiple times while searching for any piece of data. This problem is often mitigated by increasing the level of redundancy for stored state, which means paying the price in storage. A very popular use case for unstructured networks is Blockchains.</p><figure><img alt="An example of an unstructured network overlay" src="https://cdn-images-1.medium.com/max/621/1*jwWTMwDsyIIxBcQl7Smniw.png" /><figcaption>An unstructured network (Image made by the author using excalidraw.com)</figcaption></figure><p>There is a third type of topology which we will only briefly mention since it does not sit firmly in the realm of open and decentralized P2P networks. <strong>Superpeers </strong>is a semi centralized topology where some peers might either be pre-selected or elected based on the resources they possess. These selected nodes are called “Super Peers” since they function as “mini-servers”, bearing much of the load instead of other peers with lesser resources. This architecture can be very efficient for routing requests and data storage, it also functions well under the conditions of high churn. Super nodes however, are centralized points of failure that, if downed or compromised, can put the entire network at risk. The “Superpeers” overlay is also less scalable, if a multitude of “small” peers were to join this kind of network they would overwhelm the super peers causing availability issues.</p><figure><img alt="An example of a “Super-peers” network overlay" src="https://cdn-images-1.medium.com/max/765/1*hWbCE3j6zAW0-vfN-wSYiA.png" /><figcaption>A superpeers network (Image made by the author using excalidraw.com)</figcaption></figure><p><em>Below is a table for each of the overlays benefits and drawbacks:</em></p><figure><img alt="A table summing up the benefits and drawbacks of P2P network overlays" src="https://cdn-images-1.medium.com/max/996/1*HsrJeNOZCr5_lJLl1CIpGQ.png" /><figcaption>Table made by the author</figcaption></figure><h3><strong>Topology</strong></h3><p>The concept of topology is mostly relevant for structured P2P networks. These networks can vary greatly by their underlying structures. We call the underlying structures “Topologies” since they define a sort of map of how the network is laid out. In order to get some intuition for the challenges of structuring these networks, let’s do a quick review of three of the various common topologies underlying structured P2P networks:</p><p><strong>Full Mesh</strong> — In this extremely simple topology, each peer has a connection (edge on the graph) to every other peer. This structure is highly efficient in very small networks since all nodes are one “hop” from each other, making communication between peers direct and immediate. On larger networks this structure becomes less feasible since the number of connections any node has to maintain (which has memory implications) will increase linearly. In a network with 1,000 nodes for example, each node will have 999 edges. The total number of edges in a fully connected topology can be expressed as n(n-1)/2, in a network with a 1,000 nodes there would be 499,500 edges. Nodes in this topology are in “Full View” (mentioned in the <a href="https://medium.com/p/77284fe3b8a3">previous part</a>) of each other. This topology would only be used for extremely small networks since it does not scale well at all. Some common use cases for a full mesh would be closed P2P networks used as backbone infrastructure for data centers, or to facilitate data sharing between research institutions.</p><figure><img alt="An example of a full-mesh network topology" src="https://cdn-images-1.medium.com/max/381/1*8cGzEpNjiIEqTlb_lZaNpg.png" /><figcaption>A full mesh topology (Image made by the author using excalidraw.com)</figcaption></figure><p><strong>Dimensional Mesh </strong>— This topology arranges the network in q dimensions of m nodes, meaning the number of peers is m^q (m to the power of q) <strong>if the length of each dimension is equal</strong>. This shape is rectangular (or a grid) if q = 2, cubical if q = 3 and for more than three dimensions it would be called a “HyperMesh”. This structure allows for efficient routing for larger networks (since grids are easy to navigate) and can scale well. When nodes are added to the network, the rate of growth of the number of hops it takes to connect any two nodes can be curbed from linear to logarithmic if new nodes are dispersed on additional dimensions (this does come with a cost in terms of the complexity of rearranging the network). This structure can support complex queries, which require sampling data stored on multiple nodes, efficiently. An important factor in this topology is the network’s <strong>diameter</strong>, which is the “longest shortest path” between any two nodes. In order to optimize (shorten) its diameter the <a href="https://conferences.sigcomm.org/sigcomm/2001/p13-ratnasamy.pdf">CAN (Content Delivery Network)</a> DHT implemented a <strong>Toroidal</strong> <strong>Mesh</strong> by connecting the last nodes of each dimension with the first ones, creating a “doughnut” shape. The complexity of restructuring the network as it changes in size makes this topology less appealing for open P2P networks with high churn.</p><figure><img alt="An example of a 2 dimensional mesh topology" src="https://cdn-images-1.medium.com/max/551/1*zYNJl8ctRQZyLlVWWvgXxg.png" /><figcaption>A 2-dimensional mesh (Image made by the author using excalidraw.com)</figcaption></figure><p><strong>Ring </strong>— This fairly simple topology arranges peers in a ring or a circle. Nodes are connected to only two peers, the “previous” one and the “next” one (Each node is assigned an identifier on an orderable scale). The structure is circular which means the node that comes after the last node would be the first node. In most non-basic (optimized) implementations of a ring topology, nodes would also have <strong>Finger Tables</strong>, which are routing “shortcuts” for other, non neighboring nodes. These shortcuts would map to nodes of distances denoted by the powers of 2, specifically 2 to the exponents from 0 to log(n) — 1. This means that on an 8 peer ring numbered 0 to 7, the 0th node will have nodes 1, 2, and 4 in its routing map. This setup allows the network to scale well as the number hops will increase logarithmically while the number of peers increases linearly. A ring topology is simple and resilient; it facilitates uniform data distribution and provides reduced lookup latency. This topology is very popular and has been adopted by some large projects, such as the <a href="https://pdos.csail.mit.edu/papers/ton:chord/paper-ton.pdf">Chord</a> DHT protocol.</p><figure><img alt="An example of a ring topology with “finger table” shortcuts" src="https://cdn-images-1.medium.com/max/449/1*kei6EMwn6o9uNgYlQjn5ow.png" /><figcaption>A ring topology with “finger table” shortcuts (Image made by the author using excalidraw.com)</figcaption></figure><p>For further and much more in depth discussion of the various topologies available for these networks (which have not been included here for the sake of brevity) we will soon post a discussion dedicated solely to DHTs.</p><p>In the meantime please join us for <a href="https://medium.com/@asafkozovsky/routing-in-structured-p2p-networks-fed7e584879f">the next part which will discuss routing in structured P2P networks</a>.</p><p>This post was reviewed by <a href="https://www.linkedin.com/in/eran-asseo/">Eran Asseo</a>, A software engineer with a passion for distributed systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3d4d28e570e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are P2P networks exactly?]]></title>
            <link>https://medium.com/@asafkozovsky/what-are-p2p-networks-exactly-77284fe3b8a3?source=rss-8b853fcbe35c------2</link>
            <guid isPermaLink="false">https://medium.com/p/77284fe3b8a3</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[p2p]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <category><![CDATA[decentralization]]></category>
            <dc:creator><![CDATA[Asaf Kozovsky]]></dc:creator>
            <pubDate>Fri, 22 Sep 2023 08:55:16 GMT</pubDate>
            <atom:updated>2023-09-26T18:38:18.058Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this discussion we will examine the main differences between peer to peer architecture to that of a client — server. We will focus on the benefits P2P networks provide as well as their costs. We will also examine the use cases best suited for this architecture.</h4><p><em>This is the first post of a </em><a href="https://medium.com/@asafkozovsky/open-permissionless-p2p-networks-9e31e52703fa"><em>multipart series</em></a><em> about P2P networks.</em></p><p>A peer to peer network (sometimes referred to as a <strong>P2P</strong> network) is a decentralized network in which no central server is maintained. Each node in the network is an autonomous unit, capable of initiating and responding to requests independently. In a way each node in the network is both a client and a server, with all nodes implementing the same API. Contrast this with the clear distinction in the traditional client-server model where a service would provide specific resources (and sometimes consume resources provided by other servers) but a client will only consume resources. The server responds to client requests and never initiates them. A client can establish a longstanding connection with a server (so it can be prompted by the server as well) but a server can never initiate a connection to any “would be” client.</p><figure><img alt="Server-client architecture" src="https://cdn-images-1.medium.com/max/749/1*pyR6wTespHMgLqpXGekjKQ.png" /><figcaption>Server-client architecture (Image made by the author using excalidraw.com)</figcaption></figure><p>A node in a P2P network is considered a “peer” to all other nodes (we will use these terms interchangeably). All peers have the same basic functionality although sometimes some peers might be more “trusted” than others. In some networks nodes might have a “<strong>Full View</strong>” of each other, meaning each node has connections to all of its peers. In most P2P networks nodes would have only a “<strong>Partial View</strong>” of their peers . In order to have the most encompassing grasp possible let’s examine P2P networks in their broadest, most complex and useful form — <strong>open</strong>, fully <strong>decentralized</strong>, <strong>permissionless </strong>and <strong>censorship resistant </strong>with partial view nodes. Most of the functionality of these P2P networks is emergent, meaning it is a result of multiple peers following the same protocol. Because of the decentralized nature of these networks, the systems they produce are somewhat “Ethereal”, they exist as a structure only composed of the interactions between peers, with each node considered a “black box” by other nodes since they do not have access to the implementation under the hood of it’s API. The only evidence a node might have of its peers’ integrity is behavioral, meaning whether they follow the protocol or not. This structure is somewhat reminiscent of how social and legal structures are formed by their participants.</p><figure><img alt="Peer to peer network architecture" src="https://cdn-images-1.medium.com/max/621/1*jwWTMwDsyIIxBcQl7Smniw.png" /><figcaption>P2P architecture (Image made by the author using excalidraw.com)</figcaption></figure><p>With this distinction we could try and get some intuition of the use cases where a P2P architecture shines over that of the traditional client-server. We would attempt to do so by this, rather silly, example.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuLlv_aZjHXc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuLlv_aZjHXc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuLlv_aZjHXc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/48cd082c9e75bd166157998b2147539e/href">https://medium.com/media/48cd082c9e75bd166157998b2147539e/href</a></iframe><p>Suppose that as an enthusiastic conversationalist, you one day decide you are in the mood of a good argument. You happily go to the nearest argument clinic, which is based on a client-server architecture, and pay the receptionist at the gateway for a 5 minute long session. She routes you to the argument service room where you are immediately contradicted (no you’re not!) multiple times for an entire minute (five!) and then prompted to re-subscribe.</p><p>If this service was to really catch on, the hallways of the clinic would be so crowded it would be hard for clients to squeeze through them. The more clients would come to the argument clinic the more buildings, hallways, argument rooms and arguers (contradictors!) would be needed. This will also require more maintenance, not to mention research over the topics for arguments, and sometimes the clinics might not even be fully utilized.</p><p>Eventually the clinic’s CTO might be inclined to look elsewhere, towards a more decentralized architecture. One day a programmer might say something like “If we were to match peers keen on arguing over a specific topic with each other, we might be able to fulfill all their contrarian desires without expanding too much resources!”. This would get the CTO interested. “They could even conduct all their arguments at once without needing to form a queue” the programmer will add to the CTO’s delight. “The more of them would join, the more of them we would have keen on pairing up for an argument so we wouldn’t have any problem with the load. Maybe they could even argue in their own homes! And if some were to suddenly decide they want to quit arguing, the effect on the rest would be trivial”. Ecstatic, the CTO assigns the new task of decentralizing the clinic to the programmer and asks her how long would it take her to implement.</p><p>As she leaves the office she realizes the time estimate was probably too short, many questions begin popping into her head. how would these arguers find each other based on their topic of choice? How will they be updated with the results of other similar arguments? What would happen if some of the slower ones couldn’t keep up with the others? and how would we keep them from deteriorating to abuse? In the following discussion we would attempt to answer these rather silly questions seriously.</p><p>P2P networks are far more complex than the more popular client-server model and are far more difficult to implement, but once implemented they bring some great benefits. Here are a few areas where P2P networks shine over client-server systems:</p><ul><li><strong>Parallelism </strong>— While centralized server-client systems rely on a single service (which might be distributed over several machines, or virtual machines, under a load balancer) to satisfy client requests, a decentralized P2P network would facilitate traffic between all peers in parallel. This feature is extremely useful when large amounts of data are involved.</li><li><strong>Scalability </strong>— Adding nodes to a P2P network does not tax the network, on a server-client system adding clients requires scaling servers and scaling some services would require scaling others. Additionally very dynamic scaling might be wasteful as resources are added but not fully utilized until they are removed. In a P2P network every new node added is both providing and consuming resources, thus making the network more balanced. Furthermore when vast amounts of data are involved, storing it all in a single place might not be feasible. P2P networks balance these loads amongst all participants (with some redundancy).</li><li><strong>Flexibility </strong>— P2P networks are usually very loosely coupled, with each node acting as an encapsulated stand-alone part. This makes making changes to the entire system very easy. Updated nodes (even to the level of incompatibility) do not cause the entire system to fail. Contrast this with server-client systems which would tend to require multiple changes to the various parts of the system for any new feature (or a rollback of a faulty version) to be successfully shipped.</li><li><strong>Robustness</strong> — A P2P network is extremely resistant to node failures, it does not rely on any single node or a group of nodes to operate, unless this group consists of a large percentage of all the nodes in the network. Even then, the worst that would happen is that the network would get partitioned into multiple parts. This state would be mitigated if a good discovery algorithm has been implemented (more on this later). Contrast that with failure in a specific service which might compromise the operation of an entire client-server system.</li></ul><p>P2P networks do not come without some challenges. Most challenges arise from the complexity of maintaining a network of nodes with no “governing” central server to manage its state. Some challenges arise from security issues and a few challenges are resource related:</p><ul><li><strong>Node variance</strong> — In P2P networks (especially open ones) there are no guarantees regarding node performance or the software it’s running. Some nodes could even run different code which satisfies the network’s API requirements but under the hood behaves very differently and sometimes even maliciously.</li><li><strong>Network congestion</strong> — A P2P network might get congested as multiple nodes send large amounts of (sometimes redundant) traffic in parallel to change state in response to some event. This problem is aggravated in case of uneven node connectivity as some nodes would be “flooded” with traffic and bottleneck the system. In a server-client model these events would be handled by a single service, thus changing state would not tax the network.</li><li><strong>Node churn</strong> — In P2P networks (especially open ones) nodes might join and leave the system randomly (this is called churn). Each time this happens the network needs to incorporate these new nodes into itself. This sometimes necessitates allocating some data to the new nodes, or in case of nodes lost, mitigating the loss of said data and connectivity. These events can be very taxing on the network’s resources.</li><li><strong>Synchronization </strong>— With no central “authority” a P2P network has no simple way of reaching a consensus over its state. In a server-client model the state is handled by the centralized service which acts as a “single source of truth”. In a P2P network nodes might have to spend resources reaching consensus even on the most trivial of issues such as system time.</li><li><strong>Persistency</strong>— Storing vast quantities of data is made possible by distributing it over a large array of nodes, but maintaining data integrity and state persistence in such networks is challenging. In open, decentralized P2P networks, where no availability guarantees can be made, some redundancy is required so data remains accessible. Too much redundancy would hinder performance though. The challenge is compounded by the frequency of updates, which should disseminate to every node maintaining parts of the data.</li></ul><p>Some P2P networks take on a few centralized characteristics in order to solve the above problems. These solutions often make the network less robust since they represent distinct points of failure. In private P2P networks that might be less of an issue, but public ones often strive to minimize any centralized authority or functionality in order to avoid network attacks and downtime.</p><p>Please join our <a href="https://medium.com/@asafkozovsky/structure-and-topology-in-p2p-networks-c3d4d28e570e">next discussion where we will examine the different network overlays and structures</a>.</p><p>This post was reviewed by <a href="https://www.linkedin.com/in/eran-asseo/">Eran Asseo</a>, A software engineer with a passion for distributed systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77284fe3b8a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open, Permissionless P2P networks]]></title>
            <link>https://medium.com/@asafkozovsky/open-permissionless-p2p-networks-9e31e52703fa?source=rss-8b853fcbe35c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e31e52703fa</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[p2p-network]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[peer-to-peer]]></category>
            <dc:creator><![CDATA[Asaf Kozovsky]]></dc:creator>
            <pubDate>Fri, 22 Sep 2023 08:54:18 GMT</pubDate>
            <atom:updated>2023-10-04T20:38:50.483Z</atom:updated>
            <content:encoded><![CDATA[<h4>Peer to peer networks are an exciting part of the web. We encounter them in cloud computing (distributed computing), in file sharing networks, anonymity networks and recently blockchain networks. The popularity of the latter has ushered in a new era in the history of the internet, an era we call Web 3.0</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qEJInrld5T8ujtRo" /><figcaption>Photo by <a href="https://unsplash.com/@alinnnaaaa?utm_source=medium&amp;utm_medium=referral">Alina Grubnyak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This discussion is meant to provide a bird’s eye view of the topic of P2P networks. To broaden the view and provide intuition about the intricacies of these networks we would discuss their most complex flavor: open, permissionless and censorship resistant. Or, in other words, fully decentralized peer to peer networks.</p><p>I invite you to join me on a journey into the world of decentralized computing. If you are new to this world this would be a great entry point, since it will provide you with a very broad overview of the subject, with some specific examples sprinkled in. Posts providing a more detailed and focused view of the technologies used in P2P networks would be linked to in this discussion as they are published.</p><p>To make this discussion easier to read and to digest I have broken it into several segments. The index below would be updated whenever a segment is published. Lets jump in!</p><p><a href="https://medium.com/@asafkozovsky/what-are-p2p-networks-exactly-77284fe3b8a3">Part 1: What are P2P networks exactly?</a></p><p><a href="https://medium.com/@asafkozovsky/structure-and-topology-in-p2p-networks-c3d4d28e570e">Part 2: Structure and Topology in P2P Networks</a></p><p><a href="https://medium.com/@asafkozovsky/routing-in-structured-p2p-networks-fed7e584879f">Part 3: Routing in structured P2P networks</a></p><p>This multipart series is still a WIP, the following segments will be published every few days.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e31e52703fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>