You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Ntk_bandwidth_measurement 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. == NTK_RFC 0002 ==
  2. Subject: bandwidth measurement
  3. ----
  4. This text describes a change to the Npv7.
  5. It will be included in the final documentation, so feel free to correct it.
  6. But if you want to change the system here described, please contact us first.
  7. ----
  8. == Link measurement issues ==
  9. In the current version of the Npv7 the link quality is measured only with the
  10. rtt and packets loss, so only the lantecy is actually considered, this isn't
  11. optimal since also a link with a bandwidth of 20000 bps can have a good
  12. lantecy.
  13. It isn't a critical problem since more than one route is used to reach a
  14. single dst_node, so when a route is satured the kernel will use another one
  15. looking in the nexthop table of that route.
  16. == Improvement ==
  17. In order to improve the link measurement a node must include in the tracer
  18. pkts the available bandwidth of its traversed link.
  19. The link bandwidth, which will be used to modify the real rtt, in this way it
  20. will be possible to have a traffic shaping based also on the real bandwidth of
  21. the links.
  22. == Bandwidth measurement ==
  23. There are two phases of measurement: in the first the total bandwidth of the
  24. new links is measured by the hooking node and the destination nodes, in the
  25. second the bandwidth of the links is constantly monitored.
  26. The utilised bandwidth will be monitored with iptables and the libiptc library.
  27. See http://www.tldp.org/HOWTO/Querying-libiptc-HOWTO/bmeter.html .
  28. We also need to know the total bandwidth which can handle the network
  29. interface. What is a good method to do this?
  30. === Total available bandwidth ===
  31. {{{
  32. A <-> B <-> C
  33. }}}
  34. The node B is hooking to A and C. At the end of the hook, B measures the
  35. total available bandwidth of the links B<->C and B<->A.
  36. It sends an indefinite amount of random packets, for some seconds, to the
  37. destination of the link. The link is monitored with libiptc and the maximum
  38. rate of bytes per second is registered as the maximum available upload
  39. bandwidth for that specific link. These steps are repeated for each rnode.
  40. Since the link might be asymettric the measurement is also repeated by A and
  41. C. In the end we have the measurement of: A->B, B->A, C->B, B->C.
  42. === Realtime bandwidth monitoring ===
  43. With the use of the libiptc library, B can monitor the bandwidth usage of its
  44. links.
  45. {{{
  46. Max_link_bw = Total available bandwidth of the link
  47. free_link_bw = available/not used bandwidth of the link
  48. cur_used_link_bw= amount of bandwidth currently used
  49. Max_NIC_bw = maximum bandwidth of the network interface
  50. cur_used_NIC_bw = amount of the total bandwidth currently used of the network
  51. interface
  52. }}}
  53. To calculate the `free_link_bw':
  54. {{{
  55. free_link_bw = Max_link_bw - cur_used_link_bw
  56. if(free_link_bw > Max_NIC_bw - cur_used_NIC_bw)
  57. free_link_bw = (Max_NIC_bw - cur_used_NIC_bw);
  58. }}}
  59. The `free_link_bw' value will be used to modify the `rtt' used to sort the
  60. routes in the routing table.
  61. {{{
  62. modified_rtt(free_link_bw, real_rtt) = 27<<27 + real_rtt - bandwidth_in_8bit(free_link_bw)
  63. real_rtt must be <= 2^32-27<<27-1 (about 8 days)
  64. You can find the definition of bandwidth_in_8bit() here:
  65. http://hinezumilabs.org/cgi-bin/viewcvs.cgi/netsukuku/src/igs.c?rev=HEAD&content-type=text/vnd.viewcvs-markup
  66. }}}
  67. == Latency VS bandwidth ==
  68. It may also happens that a link has a good bandwidth but a high latency.
  69. A low latency is needed by semi-realtime applications: for a ssh connection
  70. we don't care to have a 100Mbs connection but we want to use the shell in
  71. realtime, so when we type a command we get a fast response.
  72. The Netsukuku should create three different routing tables:
  73. * the first shall include the routes formed by the links with the best bandwidth value.
  74. * the second shall include the "best latency" routes
  75. * the routes in the third table shall be an average of the first and the second tables
  76. If the protocol of the application uses the "tos" value in its IP packets, it
  77. is possible to add a routing rule and choose the right table for that
  78. protocol: the ssh protocol will be routed by the second table.
  79. == Caveats ==
  80. If the libiptc are used, it will be more difficult to port the daemon for
  81. other kernels than Linux. Libpcap is a good alternative.
  82. It is possible to capture the packets for some seconds using libpcap, count
  83. them and find how much bandwidth is used.
  84. == IGS ==
  85. The inet-gw which share their internet connection measure also the utilzed
  86. bandwidth of the Internet connection.
  87. The maximum download and upload bandwidth is known since it must be specified
  88. by the user in the netsukuku.conf config file. In this way, monitoring the
  89. device used by the Internet default route, it's trivial to known the
  90. available bandwidth.
  91. ----
  92. related: [Netsukuku_RFC]