1 /* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SURF_ROUTING_VIVALDI_HPP_
7 #define SURF_ROUTING_VIVALDI_HPP_
9 #include "src/kernel/routing/ClusterZone.hpp"
15 /** @ingroup ROUTING_API
16 * @brief NetZone modeling peers connected to the cloud through a private link
18 * This netzone model is particularly well adapted to Peer-to-Peer and Clouds platforms:
19 * each component is connected to the cloud through a private link of which the upload
20 * and download rate may be asymmetric.
22 * The network core (between the private links) is assumed to be over-sized so only the
23 * latency is taken into account. Instead of a matrix of latencies that would become too
24 * large when the amount of peers grows, Vivaldi netzones give a coordinate to each peer
25 * and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) as follows:
27 * latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB
29 * The resulting value is assumed to be in milliseconds.
31 * So, to go from an host A to an host B, the following links would be used:
32 * <tt>private(A)_UP, private(B)_DOWN</tt>, with the additional latency computed above.
33 * The bandwidth of the UP and DOWN links is not symmetric (in contrary to usual SimGrid
34 * links), but naturally correspond to the values provided when the peer was created.
35 * More information in the relevant section of the XML reference guide: @ref pf_peer.
37 * Such Network Coordinate systems were shown to provide rather good latency estimations
38 * in a compact way. Other systems, such as
39 * <a href="https://en.wikipedia.org/wiki/Phoenix_network_coordinates"Phoenix network coordinates</a>
40 * were shown superior to the Vivaldi system and could be also implemented in SimGrid.
43 * @todo: we should provide a script to compute the coordinates from a matrix of latency measurements,
44 * according to the corresponding publications.
47 class XBT_PRIVATE VivaldiZone : public ClusterZone {
49 explicit VivaldiZone(NetZone* father, const char* name);
51 void setPeerLink(NetCard* netcard, double bw_in, double bw_out, const char* coord);
52 void getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t into, double* latency) override;
56 class XBT_PRIVATE Coords {
58 static simgrid::xbt::Extension<NetCard, Coords> EXTENSION_ID;
59 explicit Coords(NetCard* host, const char* str);
62 std::vector<double> coords;
69 #endif /* SURF_ROUTING_VIVALDI_HPP_ */