Search code examples
simgrid

How latency is calculated in SimGrid


I have simple configuration of system where two hosts and link between them exist.

<link id="1" bandwidth="1Bps" latency="0"/>

Task is sent from one host to another one:

msg_task_t task = MSG_task_create("name", 1, 1, NULL);
MSG_task_send(task, "worker");

The latter host counts time while receiving task:

XBT_INFO("time %g", MSG_get_clock());
MSG_task_receive(&task, "worker");
XBT_INFO("time %g", MSG_get_clock());

I expect that sending task would last 1 sec, but I have 1.08247:

[worker:worker:(2) 0.000000] [example/INFO] time 0
[worker:worker:(2) 1.082474] [example/INFO] time 1.08247

Why is it?


Solution

  • This is because the default networking model takes into account stuff that were observed in reality by tricking the BW and latency values provided by the user.

    Check http://hal.inria.fr/hal-00646896/PDF/rr-validity.pdf for the rational (also published at TOMACS).

    In the code, you want to read https://github.com/simgrid/simgrid/blob/master/src/surf/network_cm02.cpp#L23 You will see that if you want a model that is maybe not that representative of large scale systems but easier to understand, you should switch to CM02 by adding --cfg=network/model:CM02 on the command line.