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: Thu, 21 Mar 2024 16:48:47 +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=Kfp6xFbFMOQ7In/BZ/Vzsf+xITmWfm036T4Hj3SDPEM=; b=Safp4SniK59Hi2WeaP9BwEB9kOfJLfcBA+x6eMun7WonyZvhSN+gsS3v3JkWm1Ahh/E6f7jB1Xtz7Xp9ZFlOrQCUmGzsc+teZ/vWQcTYsxEP2jpddk5MPVHebcI6C14eWH9pt5NLYCUTcT2fcqnDk6MhcIROv8LgeyBtQIm53cOjXtaliiYTyNmmLhfs+rukhllEUZthYjBq21K493a1AQLbcafgbELXBmMxdrd0JeQrwu5jObZ9FEyHvgh0XbqvxnC6iNs51SklCI7BwK06bLrTeVXlpsi5udENOXfRQq60ei4gFWb1DOxzQv/1QcneMflYalAALj+0Zo06gYDAyA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GfG6RFbWDUbV29ZCb17Jn/lN4+pZxIsbY+W0tb5dUBckZX0Y4jGEhSPMraK38mUMH5r/SAKBjE6e/7AocoIiXtKhU/AvAlUTy/v/2hyos1c5gT8b8ErNu3xKzTda/B5zJW6Knv42WIcKHUTVje7eNa3+VlvF6vjngZc52/ADg2hya6KDUHijhDV3wlSkvPQM+VAWkTuLn5DgDlT31E665ov98ouYLuS2TWSzkLe/FMIX8XwlIcACyC+vYdMPnqbdFCrBnVzQpH4ekdgy8aZUsAWqzUVM+MWcgmVMwW8UTVc3h14gM/B/R+aTh3hC37bJ7qsoq6CS70iL5664iCvTTw==

Hi Mark,

 

Now I am trying to limit both the source and destination TCP bandwidth on whichever the test gets performed. I currently got the TCP outgoing bandwidth to be limited to whichever IP on a set group. All outgoing bandwidth from Group1 is 1g, all outgoing bandwidth from Group2 is 500mb regardless of destination.

What I am trying to do is have Group1 source bandwidth change if the destination is in Group2 and vice versa. Ex:
- IP1 to IP2 will be 1G but IP1 to IP3 will change to 500mb

- IP2 to IP1 will be 1G but IP3 to IP1 will change to 500mb

Below are the example of group and the current rewrite. Please advice if it’s possible to achieve or if I am missing anything in the config file. Thank you!

Identifiers Section:
        "name": "Group1",

        "description": "Limit bandwidth 1g",
         "type": "ip-cidr-list",
         "data": { IP1, IP2 }

        "name": "Group2",

        "description": "Limit bandwidth 500mb",
         "type": "ip-cidr-list",
         "data": { IP3 }


Classifiers Section:

        "name": "Group1-limit-1",

        "description": "Identifiers we find friendly",

        "identifiers": [ "Group1" ]

        "name": "Group2-limit-500",

        "description": "Identifiers we find friendly",

        "identifiers": [ "Group2" ]

Rewrite Section:
    "rewrite": {

        "script": [

            "1000000000 as $tcp1g",

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

            "    and (",

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

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

            "    )",

            "    and (classifiers_has(\"Group1-limit-1\"))",

            "then",

            "    .test.spec.bandwidth = $tcp1g",

            "else .",

        "  end"

        ]

    },

 

    "rewrite": {

        "script": [

            "500000000 as $tcp500mb",

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

            "    and (",

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

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

            "    )",

            "    and (classifiers_has(\"Group2-limit-500\"))",

            "then",

            "    .test.spec.bandwidth = $tcp500mb",

            "else .",

        "  end"

        ]

    },

Application Section:
        "description": "Hosts we trust to do everything",

        "classifier": " Group1-limit-1”,

        "apply": [

        { "require": "all", "limits": [ "always" ] }

        ]

 

        "description": "Hosts we trust to do everything",

        "classifier": " Group2-limit-500",

        "apply": [

        { "require": "all", "limits": [ "always" ] }

        ]



From: Mark Feit <>
Date: Thursday, March 14, 2024 at 7:02
AM
To: Yamamoto, Miguel <>, <>
Subject: Re: Limit TCP Throughput Bandwidth to 500Mb

Yamamoto, Miguel writes: "rewrite": { "script": [ "500000000 as $max_bw", "| if .test.type == \"throughput\"", " and (", " (.test.spec.bandwidth == null)", " or (.test.spec.bandwidth

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

 

ZjQcmQRYFpfptBannerEnd

Yamamoto, Miguel writes:

 

    "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\")",    SEE BELOW

            "  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

 

The line with the arrow above needs an extra closing parenthesis:

 

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

 

 

The limit system adds some additional lines of script ahead of your script to make it function properly, which is why the line number is off.  I’ll fix the next release so the line number is correct when there’s an error; for now, subtracting 23 will get you to the right place.

 

--Mark

 




Archive powered by MHonArc 2.6.24.

Top of Page