aboutsummaryrefslogtreecommitdiff
path: root/_slides/2020-10-22-datomic-on-global-good-reasons-for-and-against-it.slides
blob: 8f207c93b764366aca28e37b0f213f64f5b9c2ba (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
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)"