This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-26
Channels
- # aleph (1)
- # announcements (9)
- # aws (6)
- # babashka (18)
- # babashka-sci-dev (25)
- # beginners (79)
- # calva (30)
- # cider (34)
- # clj-kondo (25)
- # cljsrn (6)
- # clojure (26)
- # clojure-australia (1)
- # clojure-europe (6)
- # clojure-norway (1)
- # clojure-poland (6)
- # clojure-uk (3)
- # clojured (2)
- # clojurescript (14)
- # datomic (19)
- # events (1)
- # google-cloud (1)
- # gratitude (2)
- # helix (1)
- # hyperfiddle (2)
- # interceptors (1)
- # jobs (17)
- # joyride (96)
- # leiningen (5)
- # lsp (20)
- # minecraft (2)
- # nbb (5)
- # other-languages (1)
- # re-frame (34)
- # releases (2)
- # shadow-cljs (15)
- # spacemacs (1)
- # xtdb (19)
We are deciding how to run xt in production at work and would like some advice on the tradeoffs between running our app as an xt node or having a separate xt instance running the jar. Context: Small Data™ (<1000 entities, <1000 revisions for each entity), tx log/doc store in managed postgres. From what I understand: • App as the xt node will increase startup time and build time for the app (building indexes, more deps), decrease latency for queries (no extra network jump). • Standalone xt will increase operational complexity (extra service that we need to keep running). Are there other concerns we should consider?
Hey! I'd be happy to help as much as needed with your decision making 🙂 One key aspect I should mention (but probably isn't so relevant here for your Small Data™ use case) is 'ease of scaling out', which is typically a lot easier for a discrete app tier running on lightweight machines, whereas scaling out more XT nodes is inevitably more cumbersome/expensive/slow due to all the state and need for RAM.
Additional startup time can be eliminated by keeping the indexes. The node itself starts up very fast, it's just that building indexes can take a while. And with that amount of data, it's probably lost less than JVM start time
My thoughts have been that keeping the indexes local to the process would help with scaling. Simpler when you don't need to figure out which layer is slower, plus no need to think about caching (since the data is local, and XTDB handles the caching from tx and doc stores)
Hey, in a REPL sessions, after doing some transactions and queries, when I call (xt/sync node)
a second time, it hangs indefinitely. There are only a couple of docs in the database and i use lmbd
as underlying datastore. Am I missing something?
Hey @U03GYEFN2U8 that doesn't sound right. Although you could try adding a timeout argument to the sync
call to avoid the indefinite hanging. Have you got a minimal repro? Are you shutting down and restarting the database in-between at all?
Hey @U899JBRPF. So here is my deps.edn:
{{:paths ["src"]
:deps {org.clojure/tools.deps.alpha {:git/url ""
:sha "f6c080bd0049211021ea59e516d1785b08302515"}
com.xtdb/xtdb-core {:mvn/version "dev-SNAPSHOT"}
com.xtdb/xtdb-lmdb {:mvn/version "1.21.0"}}
:mvn/repos {"snapshots" {:url ""}}}
Then I jack-in with Calva / deps.edn
Then in the REPL :
(require '[xtdb.api :as xt]
'[ :as io])
(def node (xt/start-node {:xtdb/index-store {:kv-store {:xtdb/module 'xtdb.lmdb/->kv-store
:db-dir (io/file "/tmp/lmbd-i")}}
:xtdb/document-store {:kv-store {:xtdb/module 'xtdb.lmdb/->kv-store
:db-dir (io/file "/tmp/lmbd-d")}}
}))
(xt/submit-tx node [[::xt/put {:xt/id 1
:pilot "Johanna"}]])
(xt/sync node)
I execute the require
and the def node
parts once. Afterwards I xt/submit-tx
to the node and then call xt/sync
. I works. Then I submit again and call xt/sync
and it hangs.
:thinking_face: that sounds weird regardless, but I do right away notice that you need to also configure the :xtdb/tx-log
Hey, ok I'll put that in
I think technically the in-memory (default) tx-log should still work though. Thanks for sharing the repro, I'll give it a go
Yippie! 😀 Thanks so much
Changing the version helped
Yippie! 😀 Thanks so much