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

Use iterators for in-process Series calls #7796

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

fpetkovski
Copy link
Contributor

The TSDBStore has two implementations of Series. One uses a goroutine and the other one buffers series in memory. Both are used for different use cases and trade-off CPU and memory according to the use.

In order to reconcile these two approaches, we can use an iterator which relies on coroutines that have a much lower overhead than goroutines.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

@fpetkovski fpetkovski force-pushed the series-iterator branch 3 times, most recently from ea5fe01 to 3dc7b18 Compare October 5, 2024 10:12
@fpetkovski fpetkovski marked this pull request as ready for review October 5, 2024 10:12
The TSDBStore has two implementations of Series. One uses a goroutine
and the other one buffers series in memory. Both are used for different
use cases and trade-off CPU and memory according to the use.

In order to reconcile these two approaches, we can use an iterator
which relies on coroutines that have a much lower overhead than goroutines.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
@fpetkovski fpetkovski force-pushed the series-iterator branch 3 times, most recently from 5c463da to 6e07c71 Compare October 7, 2024 08:27
go 1.22.0

toolchain go1.22.5
go 1.23.0
Copy link
Contributor

Choose a reason for hiding this comment

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

should we maybe bundle this on a separate PR? This interferes with build, maybe we should bump to 1.23 all in one pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically we don't need to bump the version in go.mod because that indicates the minimum required version. If we do a bump without using new features, it means that downstream users are also forced to update their version even though there's no reason for that.

https://go.dev/doc/modules/gomod-ref#go

@fpetkovski
Copy link
Contributor Author

The goroutine leak seems to be legit, let me take a deeper look.

@fpetkovski fpetkovski marked this pull request as draft October 7, 2024 10:08
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
@fpetkovski fpetkovski marked this pull request as ready for review October 9, 2024 05:30
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
@fpetkovski
Copy link
Contributor Author

The build and all tests should be passing now.

Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

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

lgtm

@MichaHoffmann
Copy link
Contributor

Doc failure is u related

@MichaHoffmann MichaHoffmann merged commit 6623a3c into thanos-io:main Oct 10, 2024
21 of 22 checks passed
jnyi pushed a commit to jnyi/thanos that referenced this pull request Oct 17, 2024
* Use iterators for in-process Series calls

The TSDBStore has two implementations of Series. One uses a goroutine
and the other one buffers series in memory. Both are used for different
use cases and trade-off CPU and memory according to the use.

In order to reconcile these two approaches, we can use an iterator
which relies on coroutines that have a much lower overhead than goroutines.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

* Update golangci-lint

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

* Fix lint

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

---------

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
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.

3 participants