This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-03
Channels
- # announcements (1)
- # babashka (31)
- # babashka-sci-dev (53)
- # beginners (34)
- # calva (54)
- # cider (15)
- # clj-kondo (9)
- # clojure (115)
- # clojure-dev (19)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (78)
- # clojurescript (10)
- # clr (9)
- # community-development (9)
- # core-async (24)
- # cursive (18)
- # datomic (59)
- # emacs (43)
- # figwheel-main (2)
- # fulcro (4)
- # graphql (4)
- # malli (7)
- # meander (12)
- # nbb (14)
- # off-topic (22)
- # polylith (9)
- # re-frame (5)
- # reitit (3)
- # releases (1)
- # shadow-cljs (36)
- # sql (1)
- # tools-build (23)
- # xtdb (13)
I'm doing load testing on my app with JMETER. Datomic seems to be the bottleneck. I can do 1000 concurrent users no problem on an endpoint that doesn't use datomic, but on a single instance, it seems any query that hits datomic peaks out around 30. By comparison, I tested another python app that uses postgres, and also can handle 1000 concurrent. What should I be looking for to enhance this ?
I'm monitoring RAM usage, and it never gets close to 100%. When I give it 5 CPU's, it will get pretty close. My team doesn't want to allow me 5CPU's due to budget requirements. Even with 5 CPU's it can't hit 1000k concurrent. One thing I've done quite a bit is re-establish DB connections instead of using the same connection. It will take quite a bit of time to ensure I'm using the same DB connection on every request, I know that's best practice, but I would only like to take on things that will affect load right now. Would that help ? Any other things to monitor ?
Just broad advice: you should provision a datomic peer similarity to how you would provision a read-only db replica (vs a web application), because in a sense that’s what it is.
If the hit rates are low (esp objectcache), you are paying significant IO and cpu cost
If you have extra Jvm headroom, consider increasing the bias towards objectcache. (Default is half xmx)
Depends on what your application and query code needs. You can probably give it at least half the headroom you see
Is there a way to get an overview of the OC hitrate or do you need to do it query by query like this
(d/q {:query '[:find (count ?a)
:in $ ?aname
:where [?a :artist/name ?aname]]
:args [db "The Beatles"]
:io-context :artist/by-name})
but you will want to use a callback to get it in your monitoring stack in production eventually
Here’s one
2023-02-03 13:01:58.094 76941657 [Datomic Metrics Reporter] INFO datomic.process-monitor - {:tid 29, :CacheRepair {:lo 1, :hi 1, :sum 51, :count 51}, :MemcachedGetTimeoutMsec {:lo 16.55, :hi 16.55, :sum 16.55, :count 1}, :ObjectCacheCount 12945, :PeerAcceptNewMsec {:lo 0, :hi 0, :sum 0, :count 448}, :MemcachedGetFailedMsec {:lo 0.43, :hi 65.85, :sum 152.07, :count 51}, :MemcachedPutSucceededMsec {:lo 0.52, :hi 10.43, :sum 83.29, :count 51}, :AvailableMB 850.0, :Memcache {:lo 0, :hi 1, :sum 1258, :count 1309}, :MemcachedGetSucceededMsec {:lo 0.38, :hi 30.44, :sum 1327.46, :count 1258}, :StorageGetMsec {:lo 4, :hi 15, :sum 370, :count 51}, :ReaderCachePut {:lo 1, :hi 1, :sum 51, :count 51}, :pid 4920, :event :metrics, :ObjectCache {:lo 0, :hi 1, :sum 9004, :count 10389}, :MemcachedGetMissedMsec {:lo 0.43, :hi 3.21, :sum 36.24, :count 48}, :MetricsReport {:lo 1, :hi 1, :sum 1, :count 1}, :PeerFulltextBatch {:lo 1, :hi 2, :sum 448, :count 445}, :StorageGetBytes {:lo 7448, :hi 79049, :sum 1736271, :count 51}, :DirLoads {:lo 1, :hi 1, :sum 24, :count 24}}
Oh i thought I could do
-Ddatomic.metricsCallback=db/stats-handler
(defn stats-handler [request]
(pritnln request)
)
What are the io-stats, query-stats, and process monitor metrics for your queries during the jmeter load test?
{:PeerAcceptNewMsec {:lo 0, :hi 0, :sum 0, :count 7}, :MetricsReport {:lo 1, :hi 1, :sum 1, :count 1}, :PeerFulltextBatch {:lo 1, :hi 1, :sum 7, :count 7}, :AvailableMB 2970.0, :ObjectCacheCount 523}
My report has far less data than yours @U09R86PA4
I have an attribute in schema
{:db/ident :company/slug
:db/valueType :db.type/string
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/many}
but then I found this in docs
Only (:db.cardinality/one) attributes can be unique
but this seems to work fine, so maybe documentation is outdated or there could be issues with indexing?
datomic on-prem 0.9.6045