Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

semiotic-ai/elric-rs

Repository files navigation

elric-rs

This is a Rust implementation of the substreams-sink-rust with focus to insert data into Clickhouse as fast as possible.

The main difference between this and sustreams-sink-sql is about the clickhouse driver used. Our version uses clickhouse.rs which contains some optimizations: instead of batching, we stream the data directly to clickhouse using async-inserts so the memory usage is way lower and the network load is spread throughout the program lifetime.

Detail implementation

Cursor Persistence

We use replace on duplicates to persist cursor. This means that we are constantly inserting the cursor and use the latest of them to recover from a stop.

Block Undo Signal

We use the same strategy used by substreams-sink-database which we use a configurable buffer so we are up to chain head minus the buffer. This value is configured to be "final" so no undo blocks occours.