hu.mta.sztaki.lpds.cloud.simulator.io
Class NetworkNode

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.io.NetworkNode
Direct Known Subclasses:
Repository

public class NetworkNode
extends Object

This class represents a networked element in the system. The class also contains the definitions for the helper classes in the network simulation that together are responsible to introduce and simulate network delays in the system. The instances of this class are always present and represent the general network capabilities in the hosts.

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013" "Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2012,2014-"

Nested Class Summary
static class NetworkNode.NetworkException
           
(package private) static class NetworkNode.SingleTransfer
          The instances of this class represent an individual data transfer in the system.
 
Field Summary
 MaxMinConsumer diskinbws
          Models the write bandwidth of the disk of this network node
 MaxMinProvider diskoutbws
          Models the read bandwidth of the disk of this network node
 MaxMinConsumer inbws
          Models the incoming network connections of this network node
private  Map<String,Integer> latencies
          The direct network connections of this network node.
 MaxMinConsumer meminbws
          Models the memory write bandwidth on this network node
 MaxMinProvider memoutbws
          Models the memory read bandwidth on this network node
private  String name
          The name of this network node (this could be an IP or what is most suitable for the simulation at hand).
 MaxMinProvider outbws
          Models the outgoing network connections of this network node
 
Constructor Summary
NetworkNode(String id, long maxInBW, long maxOutBW, long diskBW, Map<String,Integer> latencymap)
          This function initializes the bandwidth spreaders for the node to ensure equal network share for each transfer occurring on the node.
 
Method Summary
static int checkConnectivity(NetworkNode from, NetworkNode to)
          Determines if there is direct network connection possible between two network nodes
 long getDiskbw()
          The bandwidth available when duplicating local disk contents.
 long getInputbw()
          Determines the total input bandwidth available for the node
 String getName()
          Allows to query the networknode's name
 long getOutputbw()
          Determines the total output bandwidth available for the node
static ResourceConsumption initTransfer(long size, double limit, NetworkNode from, NetworkNode to, ResourceConsumption.ConsumptionEvent e)
          This function ensures the proper initialization of an individual transfer.
 ResourceConsumption pushFromMemory(long size, double limit, boolean toDisk, ResourceConsumption.ConsumptionEvent e)
          This function allows the simplified creation of singletransfer objects for modeling the operation of writing data to the disk/network of this node from its memory.
 ResourceConsumption readToMemory(long size, double limit, boolean fromDisk, ResourceConsumption.ConsumptionEvent e)
          This function allows the simplified creation of singletransfer objects for modeling the operation of reading data from the disk/network of this node to its memory.
 String toString()
          provides an overview of the network node concentrating on the network's properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inbws

public final MaxMinConsumer inbws
Models the incoming network connections of this network node


outbws

public final MaxMinProvider outbws
Models the outgoing network connections of this network node


diskinbws

public final MaxMinConsumer diskinbws
Models the write bandwidth of the disk of this network node


diskoutbws

public final MaxMinProvider diskoutbws
Models the read bandwidth of the disk of this network node


meminbws

public final MaxMinConsumer meminbws
Models the memory write bandwidth on this network node


memoutbws

public final MaxMinProvider memoutbws
Models the memory read bandwidth on this network node


name

private final String name
The name of this network node (this could be an IP or what is most suitable for the simulation at hand).


latencies

private final Map<String,Integer> latencies
The direct network connections of this network node. Contents of the map:

Constructor Detail

NetworkNode

public NetworkNode(String id,
                   long maxInBW,
                   long maxOutBW,
                   long diskBW,
                   Map<String,Integer> latencymap)
This function initializes the bandwidth spreaders for the node to ensure equal network share for each transfer occurring on the node.

Parameters:
maxInBW - the input bw of the node
maxOutBW - the output bw of the node
diskBW - the disk bw of the node
Method Detail

getOutputbw

public long getOutputbw()
Determines the total output bandwidth available for the node

Returns:
the maximum bandwidth with this network node can send data to the outside world

getInputbw

public long getInputbw()
Determines the total input bandwidth available for the node

Returns:
the maximum bandwidth with this network node can receive data from the outside world

getDiskbw

public long getDiskbw()
The bandwidth available when duplicating local disk contents.

Returns:
the maximal bandwidth usable by the network node while copying a file or raw disk blocks on its storage subsystem

initTransfer

public static ResourceConsumption initTransfer(long size,
                                               double limit,
                                               NetworkNode from,
                                               NetworkNode to,
                                               ResourceConsumption.ConsumptionEvent e)
                                        throws NetworkNode.NetworkException
This function ensures the proper initialization of an individual transfer.

Parameters:
size - defines the size of the transfer to be simulated
from - defines the source of the transfer
to - defines the destination of the transfer
e - defines the way the initiator will be notified upon the completion of the transfer
Returns:
the resource consumption object representing the transfer. This is returned to allow the cancellation of the object or to allow the observation of its state.
Throws:
NetworkNode.NetworkException

pushFromMemory

public ResourceConsumption pushFromMemory(long size,
                                          double limit,
                                          boolean toDisk,
                                          ResourceConsumption.ConsumptionEvent e)
This function allows the simplified creation of singletransfer objects for modeling the operation of writing data to the disk/network of this node from its memory.

Parameters:
size - the amount of data to be transferred from the memory to the disk/network (in bytes)
limit - the maximum bandwidth allowed to be available for this particular transfer (in bytes/tick)
toDisk -
  • true if the transfer should be managed to the network node's disk
  • false if the bytes read from memory should be sent over the network
e - to be fired when the transfer completes
Returns:
the resource consumption object that models the transfer. This is returned to allow the cancellation of the object or to allow the observation of its state.

readToMemory

public ResourceConsumption readToMemory(long size,
                                        double limit,
                                        boolean fromDisk,
                                        ResourceConsumption.ConsumptionEvent e)
This function allows the simplified creation of singletransfer objects for modeling the operation of reading data from the disk/network of this node to its memory.

Parameters:
size - the amount of data to be transferred to the memory from the disk/network (in bytes)
limit - the maximum bandwidth allowed to be available for this particular transfer (in bytes/tick)
fromDisk -
  • true if the transfer should be managed from the network node's disk
  • false if the bytes written to memory should be received over the network
e - to be fired when the transfer completes
Returns:
the resource consumption object that models the transfer. This is returned to allow the cancellation of the object or to allow the observation of its state.

checkConnectivity

public static int checkConnectivity(NetworkNode from,
                                    NetworkNode to)
                             throws NetworkNode.NetworkException
Determines if there is direct network connection possible between two network nodes

Parameters:
from - the network node which is expected to send some data
to - the network node which is expected to receive the sent data
Returns:
the network latency of the connection between the two
Throws:
NetworkNode.NetworkException - if there is no direct connection possible between the two specified nodes.

getName

public String getName()
Allows to query the networknode's name

Returns:
the name of the node

toString

public String toString()
provides an overview of the network node concentrating on the network's properties. useful for tracing and debug.

Overrides:
toString in class Object


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.