--- title: "Datomic on global: good reasons for and against it" date: 2020-10-22 layout: slides lang: en ref: datomic-on-global-good-reasons-for-and-against-it published: false --- # Datomic on global **Good** reasons for and against it --- # Premise Datomic's bottleneck is **write** throughput, not read --- When creating a new service... --- ```clojure (defn database-for-service [service] (let [prototype (prototype-for-service service)] (if (= :global prototype) :datomic #{:dynamodb :redis :nothing}))) ``` --- ...which is, in my opinion, a poor heuristic. --- The deciding factor shouldn't be the prototype, but the **cardinality** --- ```diff (defn database-for-service [service] - (let [prototype (prototype-for-service service)] - (if (= :global prototype) - :datomic - #{:dynamodb :redis :nothing}))) + (let [cardinality (cardinality-for-service service)] + (if (= :too-high cardinality) + #{:dynamodb :redis :nothing + :datomic)))) ``` --- ```clojue (defn database-for-service [service] (let [cardinality (cardinality-for-service service)] (if (= :too-high cardinality) #{:dynamodb :redis :nothing :datomic)))) ``` --- But how to determine when the cardinality is **`:too-high`**? --- Let's think about the cardinality of existing services we know --- What is the cardinality of... --- # savings-accounts --- # inductor --- # crebito --- # diablo --- # lost-boy? --- # hook? --- # ledger --- # blackleach --- # notification --- # toasty --- # auth --- # waypoint --- # jurassic-park --- Compare the database choice of services with similar cardinalities: ## notifications vs toasty --- Compare different cardinalities for services on global prototype: ## jurassic-park vs auth --- Compare different cardinality for different services inside the same domain: ## savings-accounts -> blackleach -> diablo -> ledger --- ## Thank you! References: 1. these slides: [{{ site.tld }}/slides.html]({% link slides.md %}) 2. [prose version of this presentation]({% link _articles/2020-10-22-datomic-on-global-good-reasons-for-and-against-it.md %}) 3. "[Understanding Database Sharding](https://www.digitalocean.com/community/tutorials/understanding-database-sharding)"