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