6 .. _understanding_lv08:
8 Understanding the default TCP model
9 ***********************************
10 When simulating a data transfer between two hosts, you may be surprised
11 by the obtained simulation time. Lets consider the following platform:
15 <host id="A" speed="1Gf" />
16 <host id="B" speed="1Gf" />
18 <link id="link1" latency="10ms" bandwidth="1Mbps" />
20 <route src="A" dst="B">
21 <link_ctn id="link1" />
24 If host `A` sends `100kB` (a hundred kilobytes) to host `B`, one could expect
25 that this communication would take `0.81` seconds to complete according to a
26 simple latency-plus-size-divided-by-bandwidth model (0.01 + 8e5/1e6 = 0.81).
27 However, the default TCP model of SimGrid is a bit more complex than that. It
28 accounts for three phenomena that directly impact the simulation time even
29 on such a simple example:
31 - The size of a message at the application level (i.e., 100kB in this
32 example) is not the size that will actually be transferred over the
33 network. To mimic the fact that TCP and IP headers are added to each packet of
34 the original payload, the TCP model of SimGrid empirically considers that
35 `only 97% of the nominal bandwidth` are available. In other words, the
36 size of your message is increased by a few percents, whatever this size be.
38 - In the real world, the TCP protocol is not able to fully exploit the
39 bandwidth of a link from the emission of the first packet. To reflect this
40 `slow start` phenomenon, the latency declared in the platform file is
41 multiplied by `a factor of 13.01`. Here again, this is an empirically
42 determined value that may not correspond to every TCP implementations on
43 every networks. It can be tuned when more realistic simulated times for
44 short messages are needed though.
46 - When data is transferred from A to B, some TCP ACK messages travel in the
47 opposite direction. To reflect the impact of this `cross-traffic`, SimGrid
48 simulates a flow from B to A that represents an additional bandwidth
49 consumption of `0.05`. The route from B to A is implicitly declared in the
50 platform file and uses the same link `link1` as if the two hosts were
51 connected through a communication bus. The bandwidth share allocated to the
52 flow from A to B is then the available bandwidth of `link1` (i.e., 97% of
53 the nominal bandwidth of 1Mb/s) divided by 1.05 (i.e., the total consumption).
54 This feature, activated by default, can be disabled by adding the
55 `--cfg=network/crosstraffic:0` flag to command line.
57 As a consequence, the time to transfer 100kB from A to B as simulated by the
58 default TCP model of SimGrid is not 0.81 seconds but
60 .. code-block:: python
62 0.01 * 13.01 + 800000 / ((0.97 * 1e6) / 1.05) = 0.996079 seconds.
66 - Main existing models (contention, cste, LM07)
67 - Main concepts (Routing, LMM) + link to the papers
68 - How to switch on the command line