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

feat: WAL Manager #13428

Merged
merged 3 commits into from
Jul 11, 2024
Merged

feat: WAL Manager #13428

merged 3 commits into from
Jul 11, 2024

Conversation

grobinson-grafana
Copy link
Contributor

@grobinson-grafana grobinson-grafana commented Jul 5, 2024

What this PR does / why we need it:

This commit contains a WAL Manager that manages a pool of segments, and allows a configurable amount of data to be buffered in memory. More data allows for bursts of Append operations that exceed the rate at which segments can be flushed, but adds latency.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@grobinson-grafana grobinson-grafana changed the title WIP: WAL Manager feat: WAL Manager Jul 8, 2024
@grobinson-grafana grobinson-grafana force-pushed the grobinson/wal-manager branch 6 times, most recently from afc79c5 to d2fc460 Compare July 10, 2024 10:41
@grobinson-grafana grobinson-grafana marked this pull request as ready for review July 10, 2024 10:42
@grobinson-grafana grobinson-grafana requested a review from a team as a code owner July 10, 2024 10:42
This commit contains a WAL Manager that manages a pool of segments,
and allows a configurable amount of data to be buffered in memory.
More data allows for bursts of Append operations that exceed the
rate at which segments can be flushed, but adds latency.
Copy link
Contributor

@benclive benclive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 Is this PR meant to include changes for the Push API to actually make use of the manager or is that separate?

pkg/storage/wal/manager.go Outdated Show resolved Hide resolved
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This commit changes the maxAge behavior from being checked using a
fixed interval to when the flush loop gets the next segment to
flush. This improves utilization, where as before we would have a
lot of nearly empty segments.
Copy link
Contributor

@benclive benclive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This'll be far easier to manage than what we had before.

return it.r, nil
}

func (m *Manager) Get() (*PendingItem, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mega nit: Maybe this should be called GetPending or something else?
API Clients only call Append but my mental model is that Get should return a valid WAL, not a closed one.
I don't feel strongly about it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't have strong opinion on this either. I took the name Get and Put from sync.Pool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me think on this, because PutPending sounds weird and incorrect.

@grobinson-grafana grobinson-grafana merged commit 15c8b45 into main Jul 11, 2024
60 checks passed
@grobinson-grafana grobinson-grafana deleted the grobinson/wal-manager branch July 11, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants