# Fully Decentralized Information System

## P2P file sharing

* Global scale application.

Example: Gnutella.

* 40.000 nodes, 3 Mio files.
* 3M nodes (Jan 2006).

### Strengths

* **Good response time**, **scalable**.
* **No infrastructure**, **no administration**.
* **No single point of failure**.

### Weaknesses

* High network **traffic**.
* **No** **structured search**.
* **Free-riding**.

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FIXHyxOPdQChu9VQlkqER%2Fa.png?alt=media&#x26;token=a8304ed1-27a8-4cb7-ac99-509032d19bf1" alt=""><figcaption></figcaption></figure>

### Gnutella

#### Meeting Peers (Ping/Pong)

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FhhXKTtVF4QxqGlX3om9S%2Fa.png?alt=media&#x26;token=0626e5fe-5f18-4936-818a-3361837b81c7" alt=""><figcaption></figcaption></figure>

#### Protocol Message Types

| Type     | Description                                           | Contained Information                                                                            |
| -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Ping     | Announce availability and probe for other servents.   | None.                                                                                            |
| Pong     | Response to a ping.                                   | IP address and port# of responding servent; number and total kb of files shared.                 |
| Query    | Search request                                        | Minimum network bandwidth of responding servent; search criteria.                                |
| QueryHit | Returned by servents that have the requested file     | IP address, port# and network bandwidth of responding servent; number of results and result set. |
| Push     | File download requests for servents behind a firewall | Servent identifier; index of requested file; IP address and port to send file to.                |

#### Searching

(Query/QueryHit/GET)

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FXnO25Ngxstuck2KS7LYr%2Fa.png?alt=media&#x26;token=21724c62-9f7e-41ab-861d-3673496cb662" alt=""><figcaption></figcaption></figure>

#### Structureless

**Queries are flooded** to neighbors, have a TTL, and are forwarded only once.

A query may obtain **several responses** indicating which peers provide the requested file. Among those, it **selects one and is directly contacted** in order to download the file.

* Can we search using fewer packets?

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FTCEQ176LsVQj3hhhGJqf%2Fa.png?alt=media&#x26;token=ca0ce943-bfd0-4ebf-8038-69a827496eef" alt=""><figcaption></figcaption></figure>

#### Improvements in Message Flooding

Expanding Ring.

* **Start** the search with **small** TTL (e.g. TTL = 1).
* If **no success** iteratively **increases TTL** (e.g. TTL = TTL +2).

k-Random Walkers.

* **Forward** the **query** to one **randomly chosen neighbor** only, with large TTL.
* Start k random walkers.
* Random walker **periodically checks** with the requester **whether to continue**.

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2Fd592ul1C1UAsDyIj6BjY%2Fa.png?alt=media&#x26;token=eaf47bbd-ebf0-4c43-a1c2-e7e1ac9444eb" alt=""><figcaption></figcaption></figure>

## Hybrid Gnutella: “Ultrapeers”

Ultrapeers can be installed (KaZaA) or self-promoted (Gnutella v.2).

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FHA9uH173IZtjbAkbe7nB%2Fa.png?alt=media&#x26;token=bd981f64-c3ae-49c3-bf62-abdcfbf566ce" alt=""><figcaption></figcaption></figure>

## Real Gnutella Network

Popular open-source file-sharing network.

* \~450,000 users as of 2003.
* \~2,000,000 today.

Ultrapeer-based Topology.

* **Queries** **flooded** among **ultrapeers**.
* **Leaf nodes are shielded** from query traffic.
* Based on multiple crawlers.

<figure><img src="https://2823298875-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDVtU9cdYIg5EIwefavH8%2Fuploads%2FKTfiC7A6zILGJUI25ggh%2Fa.png?alt=media&#x26;token=e5d430c9-d833-49de-9cbc-a7100cb7f41a" alt=""><figcaption></figcaption></figure>
