Network Proximity {#guide-networkproximity}


User Documentation
@endWRENCHDoc @WRENCHDeveloperDoc
Developer Documentation
@endWRENCHDoc @WRENCHInternalDoc
Internal Documentation

Overview # {#guide-networkproximity-overview}

A network proximity service answers queries regarding the network proximity between hosts. The service accomplishes this by periodically performing network transfer experiments between hosts, keeping a record of observed network transfer times, and computing network distances.

Creating a network proximity service # {#guide-networkproximity-creating}

In WRENCH, a network proximity service is defined by the wrench::NetworkProximityService class, an instantiation of which requires the following parameters:

The example below shows how to create an instance that runs on host "Networkcentral", and can answer network distance queries about hosts "Host1", "Host2", "Host3", and "Host4". The service's properties are customized to specify that the service performs network transfer experiments on average every 60 seconds, and that the Vivaldi algorithm is used to compute network coordinates.

auto np_service = simulation->add(
          new wrench::NetworkProximityService("Networkcentral", 
                                       {"Host1", "Host2", "Host3", "Host4"},
                                       {{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD, "60"},
                                        {wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_SERVICE_TYPE, "VIVALDI"}},

Network proximity service properties {#guide-networkproximity-creating-properties}

The properties that can be configured for a network proximity service include:


Querying a network proximity service # {#guide-networkproximity-using}

Querying a network proximity service is straightforward. For instance, to obtain a measure of the network distance between hosts "Host1" and "Host3", one simply does:

double distance = np_service->query(std::make_pair("Host1","Host2"));

This distance corresponds to half the round-trip-time, in seconds, between the two hosts. If the service is configured to use the Vivaldi coordinate-based system, as in our example above, this distance is actually derived from network coordinates, as computed by the Vivaldi algorithm. In this case one can actually ask for these coordinates for any given host:

std::pair<double,double> coords = np_service->getCoordinates("Host1");

See the documentation of wrench::NetworkProximityService for more API methods.