driftdb
Permazen
driftdb | Permazen | |
---|---|---|
6 | 10 | |
953 | 397 | |
0.2% | 0.0% | |
6.9 | 9.4 | |
10 months ago | 13 days ago | |
TypeScript | HTML | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
driftdb
-
Figma Is a File Editor
(Author here) Durable Objects are a great product, especially for the “just need a sync layer” use case. The db layer mentioned in the article is built to run on either Durable Objects or (as a regular Linux process) on Plane. https://driftdb.com/
- DriftDB
-
No one cares about Bun's speed. Your CI does though
I ported some tests from jest to bun recently and have been been pleasantly surprised -- it was pretty much a drop-in replacement and the speed difference is certainly noticeable.
That said, it was a tiny and simple test set[1]. It may not be ready yet for more complex tests, as the docs warn[2]:
> You've never seen a JavaScript test runner this fast (or incomplete).
[1] https://github.com/drifting-in-space/driftdb/blob/main/js-pk...
[2] https://bun.sh/
-
Help with Socket IO and dynamic rooms.
You should check out https://driftdb.com/ Might help you
- Show HN: DriftDB is an open source WebSocket back end for real-time apps
Permazen
-
ORMs are nice but they are the wrong abstraction
The most interesting/fresh approach I've seen to this problem is Permazen.
https://github.com/permazen/permazen/
It starts by asking what the most natural way is to integrate persistence with a programming language (Java in this case, but the concepts are generic), and then goes ahead and implements the features of an RDBMS as an in-process library that can be given different storage backends as long as they implement a sorted K/V store. So it can sit on top of a simple in-process file based K/V store, RocksDB, FoundationDB, or any SQL database like PostgreSQL, SQLite, Spanner, etc (it just uses the RDBMS to store sorted key/value pairs in that case).
Essentially it's a way to map object graphs to key/value pairs but with the usual features you'd want like indexing, validation, transactions, and so on. The design is really nice and can scale from tiny tasks you'd normally use JSON or object serialization for, all the way up to large distributed clusters.
Because the native object model is mapped directly to storage there's no object/relational mismatch.
-
Permazen: Language-natural persistence to KV stores
Ok, let's change to that from https://permazen.io/ above.
Usually we go the other way and prefer the project page, but there's clearly not enough info there.
- How FoundationDB works and why it works
-
Figma Is a File Editor
You can use a scalable database that gives you serializable transactions whilst not requiring you to represent your document in the relational model.
A good example of this architecture would be using FoundationDB [1] with Permazen [2]. In this design there are three layers:
1. A horizontally scaling sorted transactional K/V store. This is provided by FoundationDB. Transactions are automatically ordered within the cluster.
2. A network protocol that can serialize database transactions. Permazen has the ability to do this, you can do things like cache reads, HTTP POST transactions and so on. Stuff you can't easily do with SQL databases.
3. A way to map in-memory objects to/from key/value pairs, with schema migration, indexing and other DB-like features. Permazen also does this.
Permazen can be thought of as an ORM for KV stores. It's an in-memory library intended to execute on trusted servers (because the KV store can't do any business logic validation). However, for something like Figma where it's basically trusting the client anyway that doesn't matter. Additionally you can do some tricks with the architecture to support untrusted clients; I've explored these topics with Archie (the Permazen designer) in the past.
The nice thing about this design is that it doesn't require sharding by "file", can scale to large numbers of simultaneous co-authors, and results in a very natural coding model. However, Permazen is a Java library. To use it from a browser would be awkward. That said it has fairly minimal reliance on the JDK. You could probably auto-convert it to Kotlin and then use Kotlin/JS or Kotlin/WASM. But frankly it'd be easier to do that architecture as a real desktop app where you aren't boxed in by the browser's limitations.
The writeup mentions a couple of reasons for not using a database:
1. Relational/object mismatch. Permazen+FDB solves this.
2. Cost of a database vs S3. This is mostly an artifact of cloud pricing. Cloud is highly profitable but most of the margin comes from managed databases and other very high level services, not commodity byte storage. Given that FDB is free you could eliminate the cost gap by just running the database yourself, and especially, running it on your own metal.
Because Permazen has a pluggable KV backend and because there are backends that write to files, you can have both worlds - a scalable DB in the cloud and also write to files for individual cases where people don't want to store data on your backend.
https://www.foundationdb.org/ [1]
https://permazen.io/ [2]
-
FoundationDB: A Distributed Key-Value Store
You can do online schema changes with FDB, it all depends on what you do with the FDB primitives.
A great example of how to best utilize FDB is Permazen [1], described well in its white paper [2].
Permazen is a Java library, so it can be utilized from any JVM language e.g. via Truffle you get Python, JavaScript, Ruby, WASM + any bytecode language. It supports any sorted K/V backend so you can build and test locally with a simple disk or in memory impl, or RocksDB, or even a regular SQL database. Then you can point it at FoundationDB later when you're ready for scaling.
Permazen is not a SQL implementation. Instead it's "language integrated" meaning you write queries using the Java collections library and some helpers, in particular, NavigableSet and NavigableMap. In effect you write and hard code your query plans. However, for this you get many of the same features an RDBMS would have and then some more, for example you get indexes, indexes with compound keys, strongly typed and enforced schemas with ONLINE updates, strong type safety during schema changes (which are allowed to be arbitrary), sophisticated transaction support, tight control over caching and transactional "copy out", constraints and the equivalent of foreign key constraints with better validation semantics than what JPA or SQL gives you, you can define any custom data derivation function for new kinds of "index", a CLI for ad-hoc querying, and a GUI for exploration of the data.
Oh yes, it also has a Raft implementation, so if you want multi-cluster FDB with Raft-driven failover you could do that too (iirc, FDB doesn't have this out of the box).
FDB has something a bit like this in its Record layer, but it's nowhere near as powerful or well thought out. Permazen is obscure and not widely used, but it's been deployed to production as part of a large US 911 dispatching system and is maintained.
Incremental schema evolution is possible because Permazen stores schema data in the K/V store, along with a version for each persisted object (row), and upgrades objects on the fly when they're first accessed.
[1] https://permazen.io/
[2] https://cdn.jsdelivr.net/gh/permazen/permazen@master/permaze...
- Warp: Lightweight Multi-Key Transactions for Key-Value Stores
-
Persism 1.0.1 released - A zero ceremony ORM for Java
Compare to https://github.com/permazen/permazen ?
-
Introducing Weightless, an extremely easy to use database mapping library for Java
Did you see https://github.com/permazen/permazen - it's in the same space
What are some alternatives?
plane - 🔥 🔥 🔥 Open Source JIRA, Linear and Asana Alternative. Plane helps you track your issues, epics, and product roadmaps in the simplest way possible.
Doma 2 - DAO oriented database mapping framework for Java 8+
Centrifugo - Scalable real-time messaging server in a language-agnostic way. Self-hosted alternative to Pubnub, Pusher, Ably. Set up once and forever.
ObjectiveSql - Writing SQL using Java syntax
colyseus - ⚔ Multiplayer Framework for Node.js
Persism - A zero ceremony ORM for Java
stan.go - NATS Streaming System
hyhac - A HyperDex Haskell Client
plane - A distributed system for running WebSocket services at scale.
moditect - Tooling for the Java Module System
exhibitor - Snappy and delightful React component workshop
QueryStream - Build JPA Criteria queries using a Stream-like API