Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Expose RocksDB MultiGet: read several keys in one call

Open
#952 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, node.js
Domain
backend, database

Research direction

Start by reading the existing get/getSync bindings for Store, Database, and Transaction, plus src/stats.ts for the exposed MultiGet tickers; then check RocksDB's MultiGet and transaction APIs. Define the batch behavior against the acceptance cases for snapshots, uncommitted writes, deletions, duplicates, and synchronous cached reads. Done means the batch API covers the requested variants and a microbenchmark compares per-key reads with warm and cold cache.

Written by the indexing model from the issue text.

Description

Summary

rocksdb-js has no way to read several keys in one call. Store, Database and Transaction expose get / getSync / getBinary* for a single key, plus getRange. RocksDB's MultiGet isn't bound. Its statistics tickers are already surfaced (rocksdb.db.multiget.micros, rocksdb.multiget.io.batch.size, … in src/stats.ts), but nothing in the binding can call it.

I'd like a batched point read, so Harper can offer a multi-key Table read (HarperFast/harper#3428) without paying the per-key binding cost N times.

Why

The use case is a request that does many independent primary-key reads. In our ecommerce reference app (ecommerce-store), a cart quote does 60–150 point reads (variants, products, and SKU × location inventory rows), and a product view fill does a few dozen. Today each key costs:

  • a separate key encode and N-API crossing,
  • a separate memtable and SST lookup,
  • on a block-cache miss, its own queued async read and completion callback.

MultiGet amortizes the per-call work across the batch and lets RocksDB group the lookups (sorted keys, shared memtable/SST passes, batched I/O for the misses). The separated stack we compare against batches the same reads with Redis MGET and set-based SQL. The details are in ecommerce-store#19 and its write-up in ecommerce-store#22.

Proposed API (open to a different shape)

  • getMany(keys, options?): MaybePromise<Array<value | undefined>> in key order, with undefined for a missing key. Same contract as get: if every key is in memory, return synchronously; otherwise one promise for the batch, not one per key.
  • getManySync(keys, options?)
  • Binary variants mirroring getBinary / getBinaryFast, if that's how Harper's record decoder wants them.
  • On Transaction too, reading through the transaction's snapshot and its own uncommitted writes. RocksDB has Transaction::MultiGet and WriteBatchWithIndex::MultiGetFromBatchAndDB for this.

Acceptance

  • Inside a transaction, getMany(keys) returns exactly what keys.map(get) returns, including its own uncommitted writes, deleted keys, and duplicate keys in the input.
  • Fully cached batches resolve synchronously; a batch with misses settles once.
  • A microbenchmark comparing per-key cost against N gets, with the keys in the block cache and with the cache cold.

Out of scope

The Harper Table API on top of this is tracked in HarperFast/harper#3428. No benchmark result depends on this yet. It removes per-call work we can identify in the source, but nobody has measured that work's share of a request.

sent with Claude Opus 5.5

Dominant language
C++
Stars
24
Forks
3
Avg merge
1d 7h
Merged PRs (30d)
49

Getting set up

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.

More from HarperFast/rocksdb-js

All issues in HarperFast/rocksdb-js

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.