metabase: Cache frequently accessed singleton buckets #1686
No reviewers
TrueCloudLab/storage-core-committers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1686
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fyrchik/frostfs-node:speedup-search-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR implements (2) suggestion from #1685.
There are some buckets we access almost always, to check whether an
object is alive. In search we also iterate over lots of objects, and
tx.Bucket()
shows itself a lot in pprof.There are also buckets tied to a specific container, like
expired
.I have intentionally left them out, because it provides a noticeable increase in complexity with little speed benefits.
We can do it later after other optimizations.
@ -0,0 +14,4 @@
return &bucketCache{}
}
func lockedBucket(bc *bucketCache, tx *bbolt.Tx) *bbolt.Bucket {
Maybe make this functions methods of the cache
Having functions is good but personally I don't like we have simple global names which can be easily shadowed by a local variable, and it forces to alter, invert (lockedBucket -> bucketLocked), abbreviate (lockedBucket -> lockedBkt) local variable names
I was thinking about it: the reason I have used functions, is because I do a nil check inside.
From method calls I usually expect to panic on nil.
And
(*bucketCache)(nil).lockedBucket(tx)
looks unusual.I will think about your suggestion a bit more.
Maybe just rename function, so it has a verb in the name? Like
getLockedBucket
.Used
getLockedBucket
, similar for others.ec2871dd64
to1e89684ac2
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings