You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There don't seem to be many documents explaining the technical details of RethinkDB.
Are there any docs available for these?
A description of the on disk file formats, how they are used, typical write patterns.
Explanation of caching strategy for documents and data flow of documents from memory to disk and back.
Overview of memory usage, major memory pools.
Garbage collection overview, how are documents are marked dead and files updated, how are indexes updated, garbage collection heuristics.
I know there is a separate documentation repository, but I am looking for docs intended for contributors and any not widely published internal development docs.
Thanks for asking. This type of documention does indeed belong in this repo. There is some incomplete information in src/README and in comments spread throughout the source. I don't have full answers to all your questions, but here are some pointers for where to look:
src/arch/io The lowest-level IO layer has implementations for each supported platform
src/serializer/log The log serializer fills file extents with logically-addressed blocks. They are garbage collected.
src/buffer_cache Those blocks are cached in memory
src/btree They contain btree nodes which contain documents and indexes.
src/clustering It is all abstracted with some sharding and replication
src/rdb_protocol The data is accessed using the ReQL query language
We allocate memory using jemalloc. Some specific things like coroutine stacks are pooled.
Internally, we divide the data file into extents of currently 512 KB each. At any time, there is a set of active extents. Data is written only to the end of an active extent. Once an extent is full, a different extent becomes active. Eventually, old extents get garbage collected on a per-extent basis. Still current data from the extent is copied over to one of the active extents. Once all current data has been copied out of the garbage collected extent, it can become active again and is overwritten with new data. In a sense, RethinkDB is append-only on a per-extent level.
The current cache was implemented by @srh in #1642. There is some discussion about its design in #97.
We've also been thinking about having some of the core engineers record sessions where they describe key pieces of the architecture to help disseminate useful information. Creative ideas are welcome!
Activity
AtnNn commentedon Feb 7, 2017
Thanks for asking. This type of documention does indeed belong in this repo. There is some incomplete information in src/README and in comments spread throughout the source. I don't have full answers to all your questions, but here are some pointers for where to look:
src/arch/ioThe lowest-level IO layer has implementations for each supported platformsrc/serializer/logThe log serializer fills file extents with logically-addressed blocks. They are garbage collected.src/buffer_cacheThose blocks are cached in memorysrc/btreeThey contain btree nodes which contain documents and indexes.src/clusteringIt is all abstracted with some sharding and replicationsrc/rdb_protocolThe data is accessed using the ReQL query languageWe allocate memory using jemalloc. Some specific things like coroutine stacks are pooled.
@danielmewes gave an overview of the garbage collection in a comment here:
The current cache was implemented by @srh in #1642. There is some discussion about its design in #97.
If you have any questions that are more specific, please come bug us in https://rethinkdb.slack.com/messages/engineering/.
mglukhovsky commentedon Feb 7, 2017
We've also been thinking about having some of the core engineers record sessions where they describe key pieces of the architecture to help disseminate useful information. Creative ideas are welcome!