Skip to content

Change the algorithm used for byte-based log rate limiting #727

@ctlong

Description

@ctlong

Enter an issue title

Change the algorithm used for byte-based log rate limiting.

Summary

Context

Diego v2.66.0 added support for a new byte-based log rate limiting mechanism with per-LRP limits (see: proposal). That mechanism currently implements a "token bucket" of size r, initially full and refilled at rate r tokens per second, where r is the log rate limit for the LRP in question. Whenever the log rate limit for an LRP is exceeded an error message (i.e. app instance exceeded log rate limit) is inserted into the LRPs log stream.

Problem

Hypothetical scenario where many/all log lines are dropped
No log line can be emitted unless it's byte size is below the log rate limit for the LRP. This means that if the log rate limit for an LRP is set below the max log line size, 61440B (~64K), then potentially many (or even all) log lines will be dropped for being too large. We could consider this as either a feature or a bug.

Too many log rate limit exceeded error messages
The error messages are emitted every time the log rate limit is exceeded. If that's happening consistently then the error messages – which are not counted against the log rate limit – may significantly increase the actual log rate of the app. This definitely seems like a bug that we should fix.

Proposal

  1. Make sure documentation makes the hypothetical scenario where many/all log lines are dropped very clear so that developers can adjust their app's logging or their log rate limits accordingly.
  2. If the log rate limit is exceeded then drop all logs for 1 second (i.e. introduce a penalty box).
  3. Update the generic error message to include more meaningful information.

Diego repo

  • executor

Describe alternatives you've considered (optional)

  • We could make a change in CAPI to not allow log rate limits that are below the max log line size.
  • Only emit an error message every second rather than after the log rate limit has been exceeded.
  • Declare the hypothetical scenario where many/no log lines are allowed as a bug rather than a feature. Change implementation s.t. If the log rate limit is set below the max log line size then set the burst capacity to the max log line size (i.e. the min bucket size is the max log line size).

Additional Text Output, Screenshots, or contextual information (optional)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions