Fork me on GitHub
#xtdb
<
2022-07-16
>
phronmophobic17:07:36

Which xtdb storage options allow connections from multiple processes?

refset19:07:57

Hey, any tx log + document store combo that isn't backed by an embedded KV store will do the job https://docs.xtdb.com/administration/configuring/#_storage (which is something worth clarifying in this part of the docs next week...thanks for the inspiration!)

refset19:07:44

(^ presuming you mean processes across different machines, i.e. a cluster of nodes)

phronmophobic19:07:58

Thanks for the quick response. I meant multiple processes on the same machine.

phronmophobic19:07:17

Basically, I want to share a db across multiple processes on the same machine. I started with rocksdb which gives:

Execution error (RocksDBException) at org.rocksdb.RocksDB/open (RocksDB.java:-2).
While lock file: dev/index-store/LOCK: Resource temporarily unavailable
Not sure which storage option might be the best fit for this setup.

phronmophobic19:07:06

My use case is pretty low volume, but ideally, it would be great to have an option where I can use the same db across multiple processes without having to run an additional db process (like postgres).

phronmophobic03:07:49

It's possible that I missed it, but a feature matrix for the different storage solution would be really helpful.

👍 1
refset18:07:59

Ah, maybe you want the http-server + http-client then?

phronmophobic18:07:17

wouldn't that require running a separate process for the db?

refset18:07:40

nope, you can still embed the node (with embedded HTTP server) in one of your app processes

refset18:07:58

it's not terribly efficient though if there's no actual network

refset18:07:06

The existing KV stores aren't equipped for multi-process usage, although RocksDB does have an "open as secondary" API which might work okay but I've not attempted to use it before

refset18:07:27

you could also have multiple KV index-stores, one per process, but that would be pretty an inefficient use of resources also (more so than HTTP overheads, I expect)

phronmophobic18:07:56

Just a little more background. I'm working on some dev tooling that has some state it would like to store. The goal is to use the same dev tooling across multiple projects which each have their own repl. There's not really a master process.

👍 1
phronmophobic18:07:22

I know sqlite has a multi-process mode, https://www.sqlite.org/faq.html#q5

phronmophobic18:07:35

I wasn't sure if any of the kv-stores did

refset18:07:09

Thanks, that is useful to know. If the state isn't huge then SQLite might actually be a good option for the tx-log + doc-store in that case - have each node, in each project, maintain its own KV store

phronmophobic18:07:07

Would that allow data to be shared across projects?

refset18:07:48

yep, all nodes pointing at a shared SQLite file in a common directory containing the tx-log + doc-store

refset18:07:18

It could only work with that multi-process mode though, which I've not tried

phronmophobic18:07:19

So if I wanted to share the data, I would just use a single KV store for all projects? > have each node, in each project, maintain its own KV store Is this for a per-project setup or still connected to a shared setup?

phronmophobic18:07:44

Yea, I realize this is an odd use case.

phronmophobic18:07:38

The idea is like having a .emacs file that is shared for all development, but using a database rather than a text file.

refset19:07:03

I meant KV store per project (for the index-stores only), all pointing at a common SQLite containing the tx-log and doc-store

👍 1
phronmophobic19:07:54

oh! got it! Thanks for the help. I'll give it a shot 🤞.

🤞 1
refset21:07:27

cool, I'd be happy to help with getting the config nailed down. Also curious to hear how you get on in any event 🙂

👍 1