Skip to content
Daniel Andres Pelaez Lopez edited this page Oct 18, 2018 · 26 revisions

jDHTUQ is a peer-to-peer DHT system based on Chord algorithm, but built to generalize the implementation of peer-to-peer DHT systems. It have two fundamental services, put and get of a resource.

jDHTUQ is using:

  • Reusable api for lookup and storage
  • One implementation of Chord algorithm
  • One implementation of a resources management (DHash)
  • Spring Boot Starters for easy setup
  • Independent communication module configurable
  • Peer to peer communication simulation using a data structure
  • Peer to peer network communication using sockets

This project is conformed by a communication module, storage services api, lookup services api and two implementations, Chord like lookup service and DHash like storage service.

The communication module is designed to be customizable and reusable. It have two general implementations, communication on a data structure (exist graphics user interface where you see how the algorithm lookup and transfers) and on a network.

Storage services api and lookup services api defines all services necessary for implementation of resources management and overlays network (like Chord, Kademlia, Pastry, Biseroy, etc).

Chord layer is an implementation of overlay network and exposes all services from lookup services api. DHash layer is an implementation of resources management and exposes all services from storage services api. This is made to be loosely coupled. For example, it is possible to implement any overlay network that implements the lookup services api and use the same layer of resources management.

Index

  1. Download jDHTUQ
  2. Running jDHTUQ
  3. Peer to peer simulation interface
    1. Routing and storage
    2. Specifing length key
    3. Creating nodes
    4. Deleting nodes
    5. Putting resources
    6. Getting resources
    7. Hashing utilities
  4. Peer to peer standalone network interface
  5. Peer to peer standalone network
  6. Using layers as dependencies
  7. Integration tests
    1. Integration tests for data structure peer to peer simulation
    2. Integration tests for socket - network peer to peer simulation

Download jDHTUQ

Github Releases (by Asset) Github Releases (by Asset) Github Releases (by Asset)

Running jDHTUQ

You can download any of the versions and run with a double click or with java -jar command The node created will save the resouces in the build/dhash path.

Peer to peer simulation interface

The data structure GUI is composed by two main components, routing and storage, and hashing utilities.

Routing and storage

Specifing length key

The length key is the hashing length in BITS. Represents the size of fingers table (for lookup service Chord) and therefore impact of stabilization time of network.

To configure the length key, use the spinner in Hashing Configurations(brown color).

**Note: **For hashing we use SHA-1. If length key is lower than 160 bits, THERE IS NOT guaranteed that all hashings generated will be unique.

Creating nodes

There are three ways to create nodes: Create Node, Create N Nodes and Create F Nodes. This operations are in Nodes Manager (green color).

Create Node creates a node with the specified name. If there is not name specified, the node name is generated automatically lik an incremental numbere. If you want, you can simulate the behavior in the peer to peer network communicacion using as name the internet address.

Create N Node creates a determinate nodes number. Must set a number greater that 0.

Create F Node creates a determinate number of nodes based on a text file with nodes names separated by ENTER.

All nodes created are shown like list in Nodes Manager (green color) linking node hashing and name, also it is showing in Ring Panel (blue color) like a point in circle with node number . The list is ordered by hashing.

You can select any node in Ring Panel (blue color) or in Nodes Manager (green color). In Hashing Configurations (brown color) shows the hashing (green color) of selected node. You can configure how many digits displayed using spinner (next of hashing).

Deleting nodes

For deleting nodes, you can select any and click in Delete Node in the Nodes Manager (green color).

Putting resources

For putting a resource, select the button Put in the Services Panel (red color). It displays a file chooser, select the file to put and select Put. In the Ring Panel is displayed in green color the routing jumps for lookup and blue color the resource transfer.

The resources are stored in build/dhash/node_name. In this folder, you must find in root all resources put that will correspond to the node. To see this folder, selects the node and click in open button.

Getting resources

For getting resource, select button Get in the Services Panel (red color). It displays a dialog, sets resource name (file name, sensitive case) and select Get. In the Ring Panel is displayed in red color the routing jumps for lookup and blue color the resource transfer.

The resources obtained from get are stored into build/dhash/node_name/gets.

Hashing utilities

To see hashing utilities ,select the arrow or drag the part referred of color red, must sees like:

You can generate hashing in 3 ways:

  • Generate Hashing: Generates hashing from a String sets in the input.
  • Select a File: Generates hashing of file name.
  • Select a Folder: Generates hashing from a folder. Finds all files into this folder and generates hashing of file name.

Peer to peer standalone network interface

This works in the same way as data structure GUI. The only difference is the exit button, this button is used for exit the node correctly. Besides, this uses the local machine name to create the p2p node. You cannot start more than one standalone network node by machine (you will get network ports conflicts)

Note: You MUST used the exit button when you wants that the node exit correctly.

You can send the following properties for specific configuration:

Property Description Default
ui-network.node-name Defines the node name to use to create the p2p node. If this property is not defined, the application is going to try to find a suitable ip as node name -
logging.level.co.edu.uniquindio.dhash.resource.LogProgressStatus Log level for transferring. In DEBUG, you can see the whole process of Get and Put INFO

Those properties can be sent by -D or -- arguments in boot up, for instance, java -jar <jarname>.jar --standalone-network.node-name=10.2.1.5

Peer to peer standalone network

This is a standalone network without graphic interface. This uses the local machine name to create the p2p node. You cannot start more than one standalone network node by machine (you will get network ports conflicts).

You can send the following properties for specific configuration:

Property Description Default
standalone-network.node-name Defines the node name to use to create the p2p node. If this property is not defined, the application is going to try to find a suitable ip as node name -
logging.level.co.edu.uniquindio.dhash.resource.LogProgressStatus Log level for transferring. In DEBUG, you can see the whole process of Get and Put INFO

Those properties can be sent by -D or -- arguments in boot up, for instance, java -jar <jarname>.jar --standalone-network.node-name=10.2.1.5

Using layers as dependencies

Add the following dependencies to your project to use Chord, DHash and Communication layers in your own project.

Note: This dependencies are Spring Boot Starters, so, your project must use Spring Boot

  • Chord: Maven Central
  • DHash: Maven Central
  • Communication: Use one of the following implementations
    • Data Structure: Maven Central
    • Sockets: Maven Central

Integration tests

We created some integration tests using Cucumber to demonstrate the behavior of the network in a real close scenario. The machine where we tested those had the following specifications:

  • Memory: 15,6 GiB
  • Processor: Intel® Core™ i7-7500U CPU @ 2.70GHz × 4
  • SO: Ubuntu 16.04.5 LTS 64-bit
  • Disk: 387,9 GB

Integration tests for data structure peer to peer simulation

To run these integration tests you should do the following (the whole features is going to be run)(10:50 minutes):

  • Clone the repository
  • Run gradlew :it:data-structure-it:clean
  • Run gradlew :it:data-structure-it:build
  • Run gradlew :it:data-structure-it:ittest

You can find the features - gherkin scenarios here

Integration tests for socket - network peer to peer simulation

These integrations tests require the following setup in your machine:

  • Docker
  • Docker compose

To run these integration tests you should do the following:

  • Clone the repository

  • There are seven features to run, you must run one at the time:

    • ring-creation.feature (2:20 minutes)
    • puts.feature (2:20 minutes)
    • gets.feature (2:20 minutes)
    • new-node.feature (4:40 minutes)
    • offline-node.feature (4:20 minutes)
    • leave-node.feature (2:30 minutes)
    • leave-all-nodes.feature (5:30 minutes)
  • You must execute the following commands with a user with rights to access Docker process locally

  • Run gradlew :it:socket-it:clean

  • Run gradlew :it:socket-it:build

  • Run gradlew -Dcucumber.options="classpath:features/{featureName}.feature --plugin pretty" :it:socket-it:ittest, where {featureName} is the name of the feature you want to run, for instance 'gets'

You can find the features - gherkin scenarios here