esnet / iperf

iperf3: A TCP, UDP, and SCTP network bandwidth measurement tool
Other
6.99k stars 1.28k forks source link

json-stream: UDP misleading / bad reporting on end packet #1784

Open rytiszig opened 1 month ago

rytiszig commented 1 month ago

Iper Version

iperf 3.17.1 (cJSON 1.7.15)

Problem

Different key names / different keys in end json. In tcp i see only sum_received / sum_sent. In udp I also see sum key with is not clear for what purpose. Also sender information is mixed in UDP mode.

TCP keys

$ iperf3 -c spc1  -t1  --json-stream | jq 'select(.event=="end")|.data|keys'
[
  "cpu_utilization_percent",
  "receiver_tcp_congestion",
  "sender_tcp_congestion",
  "streams",
  "sum_received",
  "sum_sent"
]

UDP keys

iperf3 -c spc1  -u -b 2G  -t1  --json-stream | jq 'select(.event=="end")|.data|keys'
[
  "cpu_utilization_percent",
  "streams",
  "sum",
  "sum_received",
  "sum_sent"
]

TCP sender

iperf3 -c spc1  -t1   --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": null,
    "bits_per_second": null
  },
  "sum_received": {
    "sender": true,
    "bits_per_second": 1269823821.06185
  },
  "sum_sent": {
    "sender": true,
    "bits_per_second": 1296456879.8836708
  }
}

UDP sender

iperf3 -c spc1  -t1 -u -b 2G  --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": true,
    "bits_per_second": 1997990120.9538348
  },
  "sum_received": {
    "sender": false,
    "bits_per_second": 1671880802.3470123
  },
  "sum_sent": {
    "sender": true,
    "bits_per_second": 1997990120.9538348
  }
}
swlars commented 1 month ago

Thank you for the bug report! It does look like "sum" should be removed from UDP, as it was in TCP. We're a little unclear on what you meant by "sender information is mixed in UDP mode." Do you mean the number of bits per second is reported incorrectly for sender and receiver?

rytiszig commented 1 month ago

No i meant direction (.sender flag) was incorrect in UDP case. Traffic was generated to spc1 in both cases (no -R flag). So .sender flags should be true like in TCP case.

rytiszig commented 1 month ago

Here more examples hope this will make more clear. In TCP direction (.sender) reports correct state. However in UDP only in "sum" object report correct state.

TCP

iperf3 -c spc1 -t1 --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": null,
    "bits_per_second": null
  },
  "sum_received": {
    "sender": true,
    "bits_per_second": 1439884257.097405
  },
  "sum_sent": {
    "sender": true,
    "bits_per_second": 1470496286.6561515
  }
}

TCP Reversed

iperf3 -c spc1 -t1 -R --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": null,
    "bits_per_second": null
  },
  "sum_received": {
    "sender": false,
    "bits_per_second": 1514642947.6901867
  },
  "sum_sent": {
    "sender": false,
    "bits_per_second": 1524969078.3049507
  }
}

UDP

iperf3 -c spc1  -t1 -u -b 2G  --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": true,
    "bits_per_second": 1998962266.3580604
  },
  "sum_received": {
    "sender": false,
    "bits_per_second": 1616139545.6026447
  },
  "sum_sent": {
    "sender": true,
    "bits_per_second": 1998962266.3580604
  }
}

UDP Reversed

iperf3 -c spc1 -t1 -u -b 2G -R --json-stream | jq 'select(.event=="end") | .data | {sum: {sender: .sum.sender, bits_per_second: .sum.bits_per_second}, sum_received: {sender: .sum_received.sender, bits_per_second: .sum_received.bits_per_second}, sum_sent: {sender: .sum_sent.sender, bits_per_second: .sum_sent.bits_per_second}}'
{
  "sum": {
    "sender": false,
    "bits_per_second": 1999547778.939142
  },
  "sum_received": {
    "sender": false,
    "bits_per_second": 1704701869.0683227
  },
  "sum_sent": {
    "sender": true,
    "bits_per_second": 1999547778.939142
  }
}