Skip to content

Instantly share code, notes, and snippets.

@sneal
Created August 13, 2024 21:02
Show Gist options
  • Select an option

  • Save sneal/8dc7f28ea44de7e46b4b2899f4cc8661 to your computer and use it in GitHub Desktop.

Select an option

Save sneal/8dc7f28ea44de7e46b4b2899f4cc8661 to your computer and use it in GitHub Desktop.

Revisions

  1. sneal created this gist Aug 13, 2024.
    40 changes: 40 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    TAS 4.0.20+ has ability to limit the log rate (bytes/sec) of applications to avoid having a single application overwhelm the logging system in Cloud Foundry.

    The general settings or ways to configure logging limits are:
    - "Default log rate limit per app" in the TAS tile under App Developer Controls
    - CF org/space quotas
    - log-rate-limit-per-second app setting

    ## Default log rate limit per app
    The global default setting is just that, a default. It's the same as setting the per-app `log-rate-limit-per-second` on
    every single app in the foundation. This is not a way to keep devs from overriding this value. Devs can override
    the global default value with a higher or lower `log-rate-limit-per-second` value.

    > __NOTE__ - If you've implemented quotas with log rate limits, it's important this setting isn't too large compared to the quota or you may unintentionally cause `cf push` to fail for entire orgs/spaces.
    ## CF org/space quotas

    The log rate quota value behaves just like any other quota value, setting a cap on shared resources within an org/space.

    Setting a log rate limit in a quota is not the same as setting a `log-rate-limit-per-second` value. The quota value
    is the MAX value the `log-rate-limit-per-second` can be set to and since the global default is essentially the same
    as setting this per app, the quota applies to the global setting as well.

    What does that mean? If you set an org log quota of 2048 bytes/sec but you set the global default to 4096 bytes/sec,
    you'll get a cf push error "organization's log rate limit exceeded: staging requires 4096 bytes per second".

    The other thing to note about the quota log rate limit value is that it takes into account all apps within the assigned
    org/space when calculating whether you have enough headroom. If you set an org log quota of 2048 bytes/sec and have two
    apps with a `log-rate-limit-per-second` of 1024 bytes/sec - everything is fine (1024 + 1024 = 2048), at least until you try to push a 3rd
    app (1024 + 1024 + 1024 = 3072).

    Just remember the quota is not implementing the log rate limit, it's capping the log rate limit settings within the org/space.

    ## log-rate-limit-per-second App Setting
    This is the value that can be set per app in the application manifest as `log-rate-limit-per-second` or via the cf scale
    command after the fact. This value by default is unlimited (unset) unless a default global log rate limit has been set. A dev
    can override this value to any setting below or even above the default value - the global value is just a default. The
    important thing to keep in mind is that cf quotas can limit the max this value can be set to, and needs to fit within
    the org/space quota alongside all other apps within the org/space.


    53 changes: 53 additions & 0 deletions test-output.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@

    Global default limit: 2048b
    Org quota limit: not set
    App limit: not set
    Result: App uses default global limit, "app instance exceeded log rate limit (2048 bytes/sec)"


    Global default limit: 2048b
    Org quota limit: 3000b
    App limit: not set
    Result: App uses default global limit, "app instance exceeded log rate limit (2048 bytes/sec)"


    Global default limit: 2700b
    Org quota limit: 2048b
    App limit: not set
    Result: Can't push the app, "organization's log rate limit exceeded: staging requires 2700 bytes per second"


    Global default limit: 2700b
    Org quota limit: 2701b
    App limit: not set
    Result: App uses default global limit, "app instance exceeded log rate limit (2700 bytes/sec)"


    Global default limit: 2700b
    Org quota limit: 2701b
    App limit: 2800b
    Result: Can't push the app, "organization's log rate limit exceeded: staging requires 2800 bytes per second"


    Global default limit: 2700b
    Org quota limit: 2800b
    App limit: 2750b
    Result: App uses the app limit, "app instance exceeded log rate limit (2750 bytes/sec)"


    Global default limit: 2700b
    Org quota limit: unlimited
    App limit: 2750b
    Result: App uses the app limit, "app instance exceeded log rate limit (2750 bytes/sec)"


    Global default limit: 2700b
    Org quota limit: unlimited
    App limit: 2048b
    Result: App uses the app limit, "app instance exceeded log rate limit (2048 bytes/sec)"


    Global default limit: 2700b
    Org quota limit: unlimited
    App limit: 2800b
    Result: App uses the app limit, "app instance exceeded log rate limit (2800 bytes/sec)"