Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory overhead of decision log event buffering #705

Closed
tsandall opened this issue Apr 13, 2018 · 0 comments
Closed

Reduce memory overhead of decision log event buffering #705

tsandall opened this issue Apr 13, 2018 · 0 comments

Comments

@tsandall
Copy link
Member

tsandall commented Apr 13, 2018

Currently, decision log events are serialized to JSON before being buffered. This introduces significant overhead and reduces the number of events that can be buffered. We should investigate an alternative in-memory representation for decision log events that increases the number of events that can be buffered.

Example scenario:

  • 1,000 decisions per second
  • 5 minute upload interval

Sample decision log event:

{
    "labels": {
      "app": "my-example-app",
      "id": "1780d507-aea2-45cc-ae50-fa153c8e4a5a"
    },
    "decision_id": "4ca636c1-55e4-417a-b1d8-4aceb67960d1",
    "revision": "W3sibCI6InN5cy9jYXRhbG9nIiwicyI6NDA3MX1d",
    "path": "http/example/authz/allow",
    "input": {
      "method": "GET",
      "path": "/salary/bob"
    },
    "result": "true",
    "requested_by": "[::1]:59943",
    "timestamp": "2018-01-01T00:00:00.000000Z"
}

Some notes about the event structure:

  • labels do not change
  • revision and path are likely the same across many events
  • decision_id is globally unique
  • timestamp is unique but may be relative to previous decision
  • input and result may be same across events but structure is not easily known to OPA

One alternative would be to compress the events before buffering them. If there's a streaming compressor that supports memory limits that would be easy enough to integrate.

ashutosh-narkar added a commit to ashutosh-narkar/opa that referenced this issue Jun 15, 2018
Fixes open-policy-agent#705

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
tsandall pushed a commit that referenced this issue Jun 15, 2018
Fixes #705

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant