6
u/__tosh Apr 21 '19
Exciting. Can anyone from juxt comment on what kind of projects have been using crux so far or which projects would be a good fit for it?
Found this on the bi-temporal model https://juxt.pro/crux/docs/bitemp.html
6
u/refset Apr 21 '19
Great question. Jon Pither's talk at Clojure/north covered this more thoroughly than the docs do currently, so hopefully we won't be waiting too long for the replay/slides to become available, but I will try to expand on what's out there so far...
Crux has not yet been officially deployed in a production system, which is why this is only an alpha release, but the fundamental design choices have certainly been inspired by the team's real-world experiences of implementing bitemporal systems in financial services: https://juxt.pro/blog/posts/case-study-bitemporal-store.html
The bitemporal+schemaless design is relatively novel and the only established database I'm aware of that has traction in this area is MarkLogic. However, the Datalog engine in Crux is powerful irrespective of bitemporality and we are hoping for Crux to be widely embraced as a general purpose database. See this recent Twitter thread where I describe building higher-level Query APIs using "decorators": https://twitter.com/toxi/status/1119651503944474625
3
u/emil0r Apr 23 '19
Any plans to add some kind of support for schema? I understand your rationale for not having any schemas in the db layer, but what about a layer above that's optional (ie, spec).
3
u/refset Apr 24 '19
Creating "decorators" (outside of the core) that can provide schema-on-read is definitely something we are excited to work on soon. We already have a prototype using JSON Schema. Schema-on-write will require centralising transactions through a gatekeeper, but it shouldn't be much trickier. We are excited to see a proliferation of experimentation in this area.
1
u/emil0r Apr 25 '19
Thank you for the clarification. Another question if I may. What plans do you have for caching? Is the database immutable and so everything can cached pretty hard?
1
u/refset Apr 25 '19 edited Apr 25 '19
You're welcome! Caching will be happening automatically by virtue of immutability, or at least until you start evicting data. As far as I'm aware, there isn't any additional caching going on _between_ independent query executions, outside of what the JVM and the K/V stores offer by default. We may yet implement ETags for the HTTP API but there are no firm plans.
Update/Elaboration: internal caching has been implemented for documents, primarily, and parsed / "compiled" queries are also cached (but this has limited effect).
3
u/grinderrz Apr 21 '19 edited Apr 21 '19
I see it is built on top of kafka, does this mean it supports streaming? I.e. can I subscribe to changes of a document? Or is it maybe somehow not compatible with this bitemporality concept?
9
u/refset Apr 21 '19
You can certainly consume from the Kafka feed directly (or you can access it via `crux.api/tx-log`) and monitor for transactions that reference a given document, but there isn't yet anything ready-made to do this and push updates over HTTP etc.
I don't think subscribing to document changes is incompatible with the bitemporality and you would be able to use the valid time timestamp to augment the filtering, e.g. ignore all corrections, or ignore changes earlier than a given time
We've looked briefly into integrating 3DF to provide streaming Datalog, which seems feasible, but that's a lot more advanced than subscribing to changes to documents :)
3
1
u/mauricioszabo Apr 25 '19
What's the recommended way to deploy the Database? Is with RocksDB? Also, is there a way to replicate all data that goes to this database to a PostgreSQL or another relational DB, so that there's a copy of all data (and my company doesn't freak out because I'm using an alpha, unknown database)?
1
u/refset Apr 25 '19
We strongly recommend using Kafka for a production system, as it stands currently. Whilst you could use RocksDB/LMDB in place of Kafka for the transaction and document logs in the Standalone mode (in conjunction with the provided backup tooling), it will take more work for you to _safely_ extract and replicate these logs out of a Standalone system than to simply consume them from Kafka and transact them into your trusty relational DB via a lightly modified ClusterNode.
14
u/yogthos Apr 21 '19
This could be the killer app for Clojure that we've been waiting for.