Skip to Content.
Sympa Menu

perfsonar-user - Re: [perfsonar-user] Limit TCP Throughput Bandwidth to 500Mb

Subject: perfSONAR User Q&A and Other Discussion

List archive

Re: [perfsonar-user] Limit TCP Throughput Bandwidth to 500Mb


Chronological Thread 
  • From: "Yamamoto, Miguel" <>
  • To: Mark Feit <>, "" <>
  • Subject: Re: [perfsonar-user] Limit TCP Throughput Bandwidth to 500Mb
  • Date: Wed, 13 Mar 2024 18:42:26 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ucsf.edu; dmarc=pass action=none header.from=ucsf.edu; dkim=pass header.d=ucsf.edu; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ONYA7NyOW5Vn7osDRy5si/UejgCWb67OST4X6I9xcks=; b=R2/Yix2TE5EJhF1+u7N3Ga8Vj3Hmk611rGBlR5yCuUeUQV/npHabmgNPeYdy/5TUIKyDND8gihXyXgTM6l1awH5S+2zgowvLLjDuLM/a9K3MLvVQ1KKvfMMq10CFbMCQg0+vH8rckO/N7ZO5fQuaChTdtk5Ng0VEa6oCNESO2QiI69kewGqEPJfysxXixRm8mjidWNOQS6eu9Dl8xoio0FT5eD5pcQOtFY80+bJEMgBTW30ixKyAFnR5AjWP/J9sn7I5UVaSFdtBO2Nfl3esT3DIe4bIcHTGUavufrfXlKdk4GA9/PwCh7T5Et2S4hN3IgUyEmMaAgIcFfEzcnwB+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MT3XMDlVItPBtPBvFEk1LcvmIrfl9KSBTtLsR/C5nT1K+8mMXYA8FGYVT1ErINkwLnFipBY9wyHwLIheBJRLQdM6b3Zl2Q6CQ9JOyOIq5pCJvwsATls/VvIU5+ZQTSwD9CDXNb8h6ZTgWDXEnpU4dZ0jhw54uxOq0Ou3TpIslsQgBi6SE1pkbseGnSOvx2cpq/jc7xC0jgl1imZT9UYTJtEongosqMoKBrb4+VkSzUH95uevrAXi98Bf03QYo4LWfOS5hhjkZVP7UbKcXfaE71OaEahdQFKSdfnt0X26qw2DPv8z1oeL3HxSCCD1CZIgiKN8bXh3douMWUoAkQnrqw==

Hi Mark,

I tried to follow the exact format that was given on the jq tutorial to limit the bandwith but it gaves me a compile error on $max_bw. I also included the whole rewrite

    "#": "-------------------------------------------------------------------",

    "#": "REWRITE:  WHAT CHANGES ARE MADE TO INCOMING TASKS?                 ",

    "#": "                                                                   ",

    "#": "This is a jq transform that makes changes to incoming tasks prior  ",

    "#": "to limit enforcement.                                              ",

    "#": "-------------------------------------------------------------------",

 

    "rewrite": {

    "script": [

        "import \"pscheduler/iso8601\" as iso;",

 

        "# This does nothing but is recommended so the statements below",

        "# all begin with |.  (This makes editing easier.)",

            ".",

 

        "# Hold this for use later.",

        "| .test.type as $testtype",

 

            "# Make some tests run a minimum of 5 seconds",

            "| if ( [\"idle\", \"idlebgm\", \"latency\", \"latencybg\", \"throughput\" ]",

        "       | contains([$testtype]) )",

            "    and .test.spec.duration != null",

            "    and iso::duration_as_seconds(.test.spec.duration) < 5",

            "  then",

            "    .test.spec.duration = \"PT5S\"",

            "    | change(\"Bumped duration to 5-second minimum\")",

            "  else",

            "    .",

            "  end",

 

        "# The end.  (This takes care of the no-comma-at-end problem)"

        ]

    },

 

    "rewrite": {

        "script": [

            "500000000 as $max_bw",

            "| if .test.type == \"throughput\"",

            "    and (",

            "      (.test.spec.bandwidth == null)",

            "      or (.test.spec.bandwidth > $max_bw)",

            "    )",

            "    and (classifiers_has (\"friendlies\")",

            "  then",

            "    .test.spec.bandwidth = 500000000",

            "    | change(\"Limited to \\($max_bw)\")",

            "  else  . ",

            "  end"

        ]

    },

 

The error:

jq: error: syntax error, unexpected then (Unix shell quoting issues?) at <top-level>, line 30:

  then

jq: 1 compile error

 

Thanks,

Miguel

 

From: Mark Feit <>
Date: Tuesday, March 12, 2024 at 4:08
PM
To: Yamamoto, Miguel <>, <>
Subject: Re: Limit TCP Throughput Bandwidth to 500Mb

Yamamoto, Miguel writes: I was wondering how to limit the TCP Throughput Bandwidth of a 1G to just be 500Mb. This is what I have so far (taken from perfSonar documentation: The good news for you and the bad news for me is that there’s a mistake

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

 

ZjQcmQRYFpfptBannerEnd

Yamamoto, Miguel writes:

 

I was wondering how to limit the TCP Throughput Bandwidth of a 1G to just be 500Mb. This is what I have so far (taken from perfSonar documentation:

 

The good news for you and the bad news for me is that there’s a mistake in the documentation that’s been there since 2018.  The bandwidth parameter of the throughput test is an integer in bits per second rather than a string with an SI suffix.  The CLI takes numbers with SI suffixes as a convenience.  I’ve corrected that and the next feature release will reflect it.  Sorry to have given you a bum steer.  :-)

 

In the first limit, I’ve corrected what you sent to reflect what the docs should have said:

 

{

    "name": "throughput-low-bandwidth",

    "description": "Limit throughput test bandwidth",

    "type": "jq",

    "data": {

        "script": [

            "500000000 as $max_bandwidth",

            "| if .type == \"throughput\" and .spec.bandwidth > $max_bandwidth",

            "  then",

            "    \"Bandwidth is limited to \\($max_bandwidth)\"",

            "  else true",

            "  end"

        ]

    }

}

Note that this will still allow any test where a bandwidth is not specified, which could run faster than that.  You can add some additional logic to also reject tests where .spec.bandwidth is null (unspecified).

 

The second one looks like a limit but has script intended for the rewriter, which is a different part of the limit configuration and works in a different context as far as what’s provided and what functions (like change()) are available to call.  That said, the syntax error in what you sent is in the line that says  if .test.spec. == true; there can’t be a trailing dot there.   Using  the rewriter is the way to go if you want to still allow tests but modify them so they don’t run any faster than your preferred number.  The only down side is that people might not check the diagnostics and see that the speed was limited and go looking for a 500M-wide bottleneck in the network someplace.

 

We’ve done some Webinars that are available on YouTube that might be useful to you:

 

At about 1:04:00 in the jq tutorial, there’s a brief discussion about the rewriter.  I believe what we have in the docs on that to be substantially complete and correct as well.

 

Hope that helps.

 

--Mark

 




Archive powered by MHonArc 2.6.24.

Top of Page