Closed cristiano-belloni closed 3 months ago
I like benchmarks, though the implementation should be the same expect the underlying storage engines, hence I would imagine (naively) that just looking at general storage engine benchmarks / browser would give you the expected answer.
Not necessarily; depending on the underlying data structures / indices used you can scale differently. How does disk / memory usage / sync speed increase with the increase of operations / records?
Under the hood, we use a fork of tuple-database that provides the ability to use different storage layers (like IndexedDB, LMDB, SQLite, etc). There are some basic storage benchmarks in that repo that provide some speed comparisons.
@cristiano-belloni do you have a specific workload in mind?
@matlin I'm trying to understand
If you're speaking about bounded complexity: Triplit stores a "triple" for every attribute/key so space complexity is O(n * k)
where n
is number of entities and k
is number of attributes per entity. However, Triplit also retains the history of edits per attribute so more accurately it would be O(n * k + e)
where e
is the number of individual edits (again each represented by a triple).
As far as how this affects the sync server, the sync server and database server are one and thensame in Triplit. So to facilitate sync, it is not necessary to hold the entire dataset in memory because it is instead stored in a persistent storage provider like SQLite, LevelDB, LMDB, etc. So when a client wants to subscribe to a query, the database will send the required triples to represent the current state of the query (all buffered into memory currently) but then doesn't need to hold on to the query result. Instead, the server is able to compute which triples to send to the client to update its view of the query by looking at state vector, which triples have been added since that sync state, and which of those triples will affect the query the client is currently subscribed to.
Thanks, that's what I wanted to know!
As a developer choosing which storage layer to use, the immediate question is: what's the performance? How does it scale in space and time? It would be good to see a benchmark with the various adapters and the performance / RAM used / disk space used with a lot of data, to understand what kind of projects is Triplit good for.