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

store: use k-way merging for proxying logic #5296

Merged
merged 28 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0fb4a18
store: use k-way merging for proxying logic
GiedriusS Apr 24, 2022
8fc05fe
Merge remote-tracking branch 'origin/main' into kway_merge_heap
GiedriusS Apr 24, 2022
0eda550
store: reuse hash + use md5
GiedriusS May 3, 2022
666ed17
store: add full streaming to proxying logic
GiedriusS May 10, 2022
244f2fc
Merge remote-tracking branch 'origin/main' into kway_merge_heap
GiedriusS May 10, 2022
fc4cd7a
proxy: make strategy tunable
GiedriusS May 30, 2022
c3532dd
proxy: fix off-by-1
GiedriusS May 31, 2022
de33878
store: use timers for canceling streaming RPC
GiedriusS Jul 21, 2022
0c2862e
store: use xxhash for hashing
GiedriusS Jul 21, 2022
4614457
Merge remote-tracking branch 'origin/main' into kway_merge_heap
GiedriusS Aug 4, 2022
d9dd9be
store: add sharding support to new code
GiedriusS Aug 4, 2022
2b31e0b
store: implement timeout for lazy proxy
GiedriusS Aug 4, 2022
2ad6080
store: uncomment err tests
GiedriusS Aug 4, 2022
abc57a7
store: bring back statistics
GiedriusS Aug 4, 2022
14884da
store: add some unit tests
GiedriusS Aug 5, 2022
3501342
CHANGELOG: update
GiedriusS Aug 5, 2022
e29ceaa
Merge remote-tracking branch 'origin/main' into kway_merge_heap
GiedriusS Sep 1, 2022
2a09329
*: fix according to comments
GiedriusS Sep 1, 2022
7dbd67e
store: remove Error() method from heap
GiedriusS Sep 1, 2022
6a4a3b3
e2e: try to repro segfault
GiedriusS Sep 1, 2022
a002a7e
store: no storeAPIs matched is always a warning
GiedriusS Sep 1, 2022
fe06cf1
e2e: fix test after recent changes
GiedriusS Sep 1, 2022
07f680f
query: remove unused constants
GiedriusS Sep 1, 2022
9ce4e0f
store: wire up proxy strategy
GiedriusS Sep 1, 2022
c0d3f46
e2e: add repro for Filip's case
GiedriusS Sep 2, 2022
003c51e
store: fix lazyRespSet At()
GiedriusS Sep 8, 2022
2d28e05
Merge remote-tracking branch 'origin/main' into kway_merge_heap
GiedriusS Sep 8, 2022
caad5c3
storepb: remove unused method
GiedriusS Sep 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re

### Changed

- [#5255](https://github.com/thanos-io/thanos/pull/5296) Query: Use k-way merging for the proxying logic. The proxying sub-system now uses much less resources (~25-80% less CPU usage, ~30-50% less RAM usage according to our benchmarks). Reduces query duration by a few percent on queries with lots of series.

### Removed

## [v0.28.0](https://github.com/thanos-io/thanos/tree/release-0.28) - 2022.08.26
Expand Down
5 changes: 4 additions & 1 deletion cmd/thanos/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func registerQuery(app *extkingpin.App) {
reqLogConfig := extkingpin.RegisterRequestLoggingFlags(cmd)

alertQueryURL := cmd.Flag("alert.query-url", "The external Thanos Query URL that would be set in all alerts 'Source' field.").String()
grpcProxyStrategy := cmd.Flag("grpc.proxy-strategy", "Strategy to use when proxying Series requests to leaf nodes. Hidden and only used for testing, will be removed after lazy becomes the default.").Default(string(store.EagerRetrieval)).Hidden().Enum(string(store.EagerRetrieval), string(store.LazyRetrieval))

cmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, tracer opentracing.Tracer, _ <-chan struct{}, _ bool) error {
selectorLset, err := parseFlagLabels(*selectorLabels)
Expand Down Expand Up @@ -292,6 +293,7 @@ func registerQuery(app *extkingpin.App) {
*webDisableCORS,
enableQueryPushdown,
*alertQueryURL,
*grpcProxyStrategy,
component.Query,
)
})
Expand Down Expand Up @@ -362,6 +364,7 @@ func runQuery(
disableCORS bool,
enableQueryPushdown bool,
alertQueryURL string,
grpcProxyStrategy string,
comp component.Component,
) error {
if alertQueryURL == "" {
Expand Down Expand Up @@ -472,7 +475,7 @@ func runQuery(
unhealthyStoreTimeout,
endpointInfoTimeout,
)
proxy = store.NewProxyStore(logger, reg, endpoints.GetStoreClients, component.Query, selectorLset, storeResponseTimeout)
proxy = store.NewProxyStore(logger, reg, endpoints.GetStoreClients, component.Query, selectorLset, storeResponseTimeout, store.RetrievalStrategy(grpcProxyStrategy))
rulesProxy = rules.NewProxy(logger, endpoints.GetRulesClients)
targetsProxy = targets.NewProxy(logger, endpoints.GetTargetsClients)
metadataProxy = metadata.NewProxy(logger, endpoints.GetMetricMetadataClients)
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestQuerier_Proxy(t *testing.T) {
logger,
nil,
store.NewProxyStore(logger, nil, func() []store.Client { return clients },
component.Debug, nil, 5*time.Minute),
component.Debug, nil, 5*time.Minute, store.EagerRetrieval),
1000000,
5*time.Minute,
)
Expand Down