P2P2DSpace Project. Project in the Technion Electrical Engineering Software Lab P2P Network, Map,...

15
P2P2DSpace Project P2P2DSpace Project
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    219
  • download

    0

Transcript of P2P2DSpace Project. Project in the Technion Electrical Engineering Software Lab P2P Network, Map,...

P2P2DSpace ProjectP2P2DSpace Project

Project in the Technion Electrical Project in the Technion Electrical Engineering Software LabEngineering Software Lab

P2P Network, Map, Background ManagerP2P Network, Map, Background Manager

Team members: Team members:

Vladimir ShulmanVladimir Shulman

Ziv RabizanovichZiv Rabizanovich

Lab Chief Engineer: Dr. Ilana DavidLab Chief Engineer: Dr. Ilana David

Instructor: Uri SchonfeldInstructor: Uri Schonfeld

IntroductionIntroductionThis part of a This part of a

project deals project deals with layers with layers which provide which provide services to the services to the application, application, such as such as network layernetwork layer, , map layer map layer (middleware) (middleware) and 3and 3rdrd party party service of service of backgroundsbackgrounds

Where we are…Where we are…

Map middlewareMap middlewareP2P2DSpace was designed in 3 layers.P2P2DSpace was designed in 3 layers.

First layer application, 3rd layer network. In order First layer application, 3rd layer network. In order to reduce complication of application layer, map to reduce complication of application layer, map layer was added as a middleware between layer was added as a middleware between application and network. Its role is to detach application and network. Its role is to detach application from network implementation. All application from network implementation. All application sees is 2D map with items, application sees is 2D map with items, coordinates and background. Map layer takes coordinates and background. Map layer takes care of all communications with the network like: care of all communications with the network like: requesting via network from several computers requesting via network from several computers (network’s functionality) their items, bringing (network’s functionality) their items, bringing background of the region from 3rd party server background of the region from 3rd party server (Background Manager), transporting items from (Background Manager), transporting items from one computer to another via network.one computer to another via network.

Sparse MatrixSparse Matrix

Backbone of map layer is SparseMatrix module. It is Backbone of map layer is SparseMatrix module. It is hash map based implementation of sparse matrix, hash map based implementation of sparse matrix, which is ideal for storing items on their 2D which is ideal for storing items on their 2D coordinates in a large 2D world. 2D map represented coordinates in a large 2D world. 2D map represented by space matrix of appropriate size and can be by space matrix of appropriate size and can be accessed by single coordinate or by region. accessed by single coordinate or by region. SparseMatrix is used to represent a region and items SparseMatrix is used to represent a region and items contained in it (also used by application and network contained in it (also used by application and network layer).layer).There’s a thread safe version of SparseMatrix: There’s a thread safe version of SparseMatrix: SyncSparseMatrix. While SyncSparseMatrix is used as SyncSparseMatrix. While SyncSparseMatrix is used as part of each module, SparseMatrix is transferable unit part of each module, SparseMatrix is transferable unit between application and map layers. between application and map layers.

BackgroundsBackgrounds

P2P2DSpace P2P2DSpace represents a represents a very large 2D very large 2D area. It would area. It would be not practical be not practical to transfer to transfer large bitmap large bitmap by demand via by demand via networknetwork

Backgrounds (continued)Backgrounds (continued)

Therefore a 3Therefore a 3rdrd party server is party server is created.created.

It holds a bitmap of a world and It holds a bitmap of a world and supplies parts of it by demand,supplies parts of it by demand,

as if all applications look at the word as if all applications look at the word through a small peep hole through a small peep hole

NetworkNetwork

The purpose of the Network Layer is to The purpose of the Network Layer is to provide a layer of p2p network for the provide a layer of p2p network for the P2P2DSpace application’s use. The P2P2DSpace application’s use. The Network Layer was designed to provide Network Layer was designed to provide a scalable and easy use of p2p network a scalable and easy use of p2p network as a middleware for P2P2DSpace as a middleware for P2P2DSpace application, while the major application, while the major requirement for it, is network’s requirement for it, is network’s scalability.scalability.

Network overviewNetwork overview

• The network represents a virtual two-dimensional The network represents a virtual two-dimensional space.space.

• Each peer in the network is awarded a region of Each peer in the network is awarded a region of responsibility in this virtual space, while the responsibility in this virtual space, while the coordinate location of the peer in this space is coordinate location of the peer in this space is calculated uniquely using the user name.calculated uniquely using the user name.

• Size of the region of responsibility depends Size of the region of responsibility depends mainly on number of peers in the network.mainly on number of peers in the network.

• The network itself is represented as a tree with The network itself is represented as a tree with up to 4 sons per each node (peer), when each son up to 4 sons per each node (peer), when each son receives quarter of the fathers region of receives quarter of the fathers region of responsibility as its own region of responsibility.responsibility as its own region of responsibility.

Network overview – cont.Network overview – cont.

• The network is able to map peer to The network is able to map peer to unique virtual region.unique virtual region.

• The network is able to map each The network is able to map each coordinate of virtual region to peer who coordinate of virtual region to peer who owns the region by user name only.owns the region by user name only.

• Each peer is able to map application's Each peer is able to map application's items to coordinates of virtual region items to coordinates of virtual region that under its responsibility.that under its responsibility.

Design decisions, principles Design decisions, principles and considerations - 1and considerations - 1

• Major issue of this project is to provide Major issue of this project is to provide a flexible implementation of virtual 2d a flexible implementation of virtual 2d space and regions, while maintaining space and regions, while maintaining scalability of the implementation. In scalability of the implementation. In order to allow simple way of describing order to allow simple way of describing regions was decided that each region regions was decided that each region may be divided into 4 equal new may be divided into 4 equal new regions, while they may be given to regions, while they may be given to other peers who joined the network.other peers who joined the network.

Design decisions, principles Design decisions, principles and considerations - 2and considerations - 2

• In order to provide network’s peers with In order to provide network’s peers with ability to find each other in the network in a ability to find each other in the network in a scalable way, the network was designed in scalable way, the network was designed in a tree form, while each peer is a node in the a tree form, while each peer is a node in the tree. Each level in a “tree” represents a tree. Each level in a “tree” represents a layer in a virtual world of regions of same layer in a virtual world of regions of same size, some of which were divided into size, some of which were divided into smaller regions (have sons) or represents a smaller regions (have sons) or represents a node in a tree which is responsible for node in a tree which is responsible for navigation from above nodes to this node's navigation from above nodes to this node's sons.sons.

Design decisions, principles Design decisions, principles and considerations - 3and considerations - 3

• Efficient disconnection of node from Efficient disconnection of node from the network. When node connects to the network. When node connects to the network, it gets from its father the network, it gets from its father region of responsibility with region of responsibility with application items in this region. It may application items in this region. It may happen that other nodes will connect happen that other nodes will connect to the network through this node, and to the network through this node, and thus this node will transfer them thus this node will transfer them regions of responsibility with regions of responsibility with applications items. applications items.

Design decisions, principles Design decisions, principles and considerations – 3 cont.and considerations – 3 cont.• For enabling efficient disconnection of this node For enabling efficient disconnection of this node

from the network, it was decided that if there were from the network, it was decided that if there were 4 sons connected to this node, all items of this 4 sons connected to this node, all items of this node are divided between sons and this node node are divided between sons and this node continue to be used only for navigation in the tree. continue to be used only for navigation in the tree. Now, during disconnection of this node, it just Now, during disconnection of this node, it just needs to ask some node, which is leaf in this needs to ask some node, which is leaf in this node’s sub-tree, to return items to leaf node’s node’s sub-tree, to return items to leaf node’s father and replace this node. This solution also father and replace this node. This solution also helps to keep region of responsibility with items in helps to keep region of responsibility with items in each node to be integral and not be broken to each node to be integral and not be broken to many small peaces (that may require unbound many small peaces (that may require unbound allocation of memory).allocation of memory).