1 /* Copyright (c) 2013-2018. 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 <simgrid/kernel/routing/ClusterZone.hpp>
10 #include <xbt/Extendable.hpp>
16 /** @ingroup ROUTING_API
17 * @brief NetZone modeling peers connected to the cloud through a private link
19 * This netzone model is particularly well adapted to Peer-to-Peer and Clouds platforms:
20 * each component is connected to the cloud through a private link of which the upload
21 * and download rate may be asymmetric.
23 * The network core (between the private links) is assumed to be over-sized so only the
24 * latency is taken into account. Instead of a matrix of latencies that would become too
25 * large when the amount of peers grows, Vivaldi netzones give a coordinate to each peer
26 * and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) as follows:
28 * latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB
30 * The resulting value is assumed to be in milliseconds.
32 * So, to go from an host A to an host B, the following links would be used:
33 * <tt>private(A)_UP, private(B)_DOWN</tt>, with the additional latency computed above.
34 * The bandwidth of the UP and DOWN links is not symmetric (in contrary to usual SimGrid
35 * links), but naturally correspond to the values provided when the peer was created.
36 * More information in the relevant section of the XML reference guide: @ref pf_peer.
38 * You can find some Coordinate-based platforms from the OptorSim project, as well as a
39 * script to turn them into SimGrid platforms in examples/platforms/syscoord.
41 * Such Network Coordinate systems were shown to provide rather good latency estimations
42 * in a compact way. Other systems, such as
43 * <a href="https://en.wikipedia.org/wiki/Phoenix_network_coordinates"Phoenix network coordinates</a>
44 * were shown superior to the Vivaldi system and could be also implemented in SimGrid.
47 class XBT_PRIVATE VivaldiZone : public ClusterZone {
49 explicit VivaldiZone(NetZoneImpl* father, std::string name);
51 void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string coord);
52 void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
55 XBT_ATTRIB_DEPRECATED_v323("Please use VivaldiZone::set_peer_link()") void setPeerLink(NetPoint* netpoint,
56 double bw_in, double bw_out,
59 set_peer_link(netpoint, bw_in, bw_out, coord);
64 class XBT_PRIVATE Coords {
66 static simgrid::xbt::Extension<NetPoint, Coords> EXTENSION_ID;
67 explicit Coords(NetPoint* host, std::string str);
68 virtual ~Coords() = default;
70 std::vector<double> coords;
72 } // namespace vivaldi
73 } // namespace routing
75 } // namespace simgrid
77 #endif /* SURF_ROUTING_VIVALDI_HPP_ */