nspcc-dev / nspcc-dev/neofs-node

Try to use metabase transaction context

Open
#1,260 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement I4 S3 U4
Dominant language
Go
Stars
38
Forks
51
Avg merge
1d 20h
Merged PRs (30d)
38

Description

One of the problems with the metabase is excessive convertions of addresses/CID/OIDs to use as keys or bucket names.
The cost is non-negligible as can be seen from the benchmarks (will provide them shortly).

Describe the solution you'd like

Introduce tx-level cache containing the most frequently used values.
Converting some items to string can be done outside of the transaction, we also can reuse the same slice for creating bucket names.

type txContext struct {
    tx *bbolt.Tx
   addr string
   cid string
   oid string
   bucketName []byte // preallocated bucket name
}

I have benched similar thing once, while trying it with pebble backend #619 , the result was positive. I think similar benefits are applicable to bolt.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the metabase implementation and its bbolt transaction paths, then review issue #619 for prior Pebble context. Define completion around measuring whether a transaction-level cache reduces conversions and reuses bucket-name storage, with benchmarks supplied for comparison.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
database, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.