-
Notifications
You must be signed in to change notification settings - Fork 59
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
Rocksdb performance tuning ideas #1660
Comments
A reverse that's rarely used: https://github.com/omgnetwork/elixir-omg/blob/master/apps/omg_db/lib/omg_db/rocksdb/core.ex#L125 defp do_filter_keys(reference, prefix) do
# https://github.com/facebook/rocksdb/wiki/Prefix-Seek-API-Changes#use-readoptionsprefix_seek
{:ok, iterator} = :rocksdb.iterator(reference, prefix_same_as_start: true)
move_iterator = :rocksdb.iterator_move(iterator, {:seek, prefix})
Enum.reverse(search(reference, iterator, move_iterator, [])) # <--- This Enum.reverse()
end |
What did you mean by that? |
@InoMurko The Not a major impact on perf though and slight impact on memory consumption. |
ah, you mean that. If I remember correctly Piotr wanted it. |
Rocksdb contains performance tuning points we can try. Full guide: https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide
These are some examples but need to be explored whether they're applicable to our uses. Many of these may not be applicable.
Collect built-in statistics
Convert iterators on large data to snapshots
I'm assuming it is performant because snapshots do not make a copy of the data as its name might imply, and the data structure is immutable so it’s just marking data with snapshot pointers and doesn’t lock writes because it’s read-only.
Consider restructuring the prefixes
Use column families to separate logical entity types
Currently all data including outputs, blocks, competitor info, etc. are all prefix-seeking on the same table.
We can tune the config per column family to suit each column family's data characteristics and access pattern.
Index optimization
It might be possible to check the current data block size and see if we're able to improve seek time by optimizing what we use as the key prefix, or on the other hand, adjust the block size.
Also more details on competing data and index caching:
Non-sync writes
Since at application-level we're dropping the non-closed blocks on a crash anyway we should be able to apply non-sync writes on rocksdb too? https://github.com/facebook/rocksdb/wiki/Basic-Operations#non-sync-writes
Write stalls
Avoid write stalls: https://github.com/facebook/rocksdb/wiki/Write-Stalls
Secondary instance
Read-only operations can be routed to secondary instance: https://github.com/facebook/rocksdb/wiki/Secondary-instance
Replication
https://github.com/facebook/rocksdb/wiki/Replication-Helpers
The text was updated successfully, but these errors were encountered: