Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Compact blocks #819

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

Compact blocks #819

wants to merge 18 commits into from

Conversation

cyriltovena
Copy link
Collaborator

There's still a lot to do:

  • Compact and remap symbols
  • Write the meta file with all stats.
  • Tests.

}
profileWriter := newProfileWriter(profileFile)

// todo new symbdb
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kolesnikovae see how we wrap the rowIterator to remap each rows value...

I'm leaving symdb alone for now as you're working on this, I'll start testing and benchmarking this for now.

@cyriltovena cyriltovena changed the title Feat/compact Compact blocks Jul 6, 2023
@cyriltovena
Copy link
Collaborator Author

Latest progress:

❯ go test -timeout 0s  -run ^TestCompact$ github.com/grafana/phlare/pkg/phlaredb -v
=== RUN   TestCompact
    compact_test.go:70: src block(# 0 ) minTime 2023-07-12T03:18:05.463+02:00 maxTime 2023-07-12T06:18:19.522+02:00 numSeries 5785 numProfiles 2650992 numSamples 168740499
    compact_test.go:70: src block(# 1 ) minTime 2023-07-12T03:18:23.382+02:00 maxTime 2023-07-12T06:18:37.453+02:00 numSeries 5284 numProfiles 2426124 numSamples 154944282
    compact_test.go:70: src block(# 2 ) minTime 2023-07-12T03:19:48.853+02:00 maxTime 2023-07-12T06:20:02.84+02:00 numSeries 6050 numProfiles 2777738 numSamples 169083573
    compact_test.go:70: src block(# 3 ) minTime 2023-07-12T03:48:23.248+02:00 maxTime 2023-07-12T06:48:37.064+02:00 numSeries 5331 numProfiles 2460948 numSamples 155860208
     compact_test.go:88: {01H54CQYRZ9H7W4594XPW502FA 9223372036854776 0 {0 0 3848695} [] {0 [] false [] false []} 2 map[] } /var/folders/6r/0_fmjlmd55b4gtg5fc9pb31c0000gn/T/TestCompact3585900395/002
    compact_test.go:89: Compaction duration 22m49.297039521s
    compact_test.go:90: numSeries 0 numProfiles 3848695 numSamples 0
--- PASS: TestCompact (1369.30s)
PASS
ok      github.com/grafana/phlare/pkg/phlaredb  1369.462s

Takes 22m to compact the latest 4 blocks directly from object store.

@cyriltovena
Copy link
Collaborator Author

cyriltovena commented Jul 12, 2023

Local compaction (download blocks first) takes 1m20.

https://flamegraph.com/share/1f92c67b-208c-11ee-85f3-ba195a7e5c95

@cyriltovena
Copy link
Collaborator Author

We just need to rewrite stacktraceids and ingest symbols and then add the files meta and that should be good to go.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant