Skip to content

Commit 59d29de

Browse files
authored
Elixir vs Go (Golang) Performance (Latency - Throughput - Saturation - Availability) (#369)
1 parent 2c079cd commit 59d29de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2395
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# New Video - https://youtu.be/iPnMPnelWOE
1+
# New Video - https://youtu.be/eDq9GbRPA0Q
22

3-
[<img src="assets/229.png?raw=true">](https://youtu.be/iPnMPnelWOE)
3+
[<img src="assets/230.png?raw=true">](https://youtu.be/eDq9GbRPA0Q)
44

55
# Support
66

assets/229.png

-348 KB
Binary file not shown.

assets/230.png

509 KB
Loading

docs/contents.md

+1
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,4 @@
158158
- [227 - MongoDB vs. PostgreSQL: Performance & Functionality](../lessons/227)
159159
- [228 - Redis vs Dragonfly Performance (Latency - Throughput - Saturation)](../lessons/228)
160160
- [229 - FASTEST Go Web Framework: gnet vs fiber vs fasthttp vs net/http?](../lessons/229)
161+
- [230 - Elixir vs Go (Golang) Performance (Latency - Throughput - Saturation - Availability)](../lessons/230)

lessons/230/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Elixir vs Go (Golang) Performance (Latency - Throughput - Saturation - Availability)
2+
3+
You can find tutorial [here](https://youtu.be/eDq9GbRPA0Q).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: elixir-app
6+
namespace: default
7+
spec:
8+
replicas: 1
9+
strategy:
10+
type: Recreate
11+
selector:
12+
matchLabels:
13+
app: elixir-app
14+
template:
15+
metadata:
16+
labels:
17+
app: elixir-app
18+
spec:
19+
terminationGracePeriodSeconds: 0
20+
containers:
21+
- name: elixir-app
22+
image: aputra/elixir-app-230-amd64:v4
23+
ports:
24+
- name: http
25+
containerPort: 8080
26+
env:
27+
- name: WEB_PORT
28+
value: "8080"
29+
- name: REPO_POOL_SIZE
30+
value: "500"
31+
- name: REPO_QUEUE_TARGET
32+
value: "5000"
33+
- name: REPO_QUEUE_INTERVAL
34+
value: "1000"
35+
- name: DATABASE_URL
36+
value: postgresql://elixir:[email protected]/mydb
37+
resources:
38+
requests:
39+
memory: 2Gi
40+
cpu: 1500m
41+
limits:
42+
memory: 4Gi
43+
cpu: 2000m
44+
# TODO: Uncomment for use in production.
45+
# readinessProbe:
46+
# httpGet:
47+
# path: /healthz
48+
# port: http
49+
# livenessProbe:
50+
# httpGet:
51+
# path: /healthz
52+
# port: http
53+
tolerations:
54+
- effect: NoSchedule
55+
operator: Exists
56+
affinity:
57+
podAffinity:
58+
requiredDuringSchedulingIgnoredDuringExecution:
59+
- labelSelector:
60+
matchExpressions:
61+
- key: app
62+
operator: In
63+
values:
64+
- elixir-app
65+
topologyKey: "kubernetes.io/hostname"
66+
nodeAffinity:
67+
requiredDuringSchedulingIgnoredDuringExecution:
68+
nodeSelectorTerms:
69+
- matchExpressions:
70+
- key: node
71+
operator: In
72+
values:
73+
- general
74+
- matchExpressions:
75+
- key: kubernetes.io/arch
76+
operator: In
77+
values:
78+
- amd64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: elixir-app
6+
namespace: default
7+
spec:
8+
sessionAffinity: ClientIP
9+
ports:
10+
- name: http
11+
port: 8080
12+
targetPort: http
13+
selector:
14+
app: elixir-app
15+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: elixir-app
6+
namespace: monitoring
7+
labels:
8+
prometheus: main
9+
spec:
10+
namespaceSelector:
11+
matchNames:
12+
- default
13+
selector:
14+
matchLabels:
15+
app: elixir-app
16+
podMetricsEndpoints:
17+
- port: http
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: elixir-client
6+
namespace: monitoring
7+
labels:
8+
prometheus: main
9+
spec:
10+
namespaceSelector:
11+
matchNames:
12+
- default
13+
selector:
14+
matchLabels:
15+
app: elixir-client
16+
podMetricsEndpoints:
17+
- port: metrics
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: go-app
6+
namespace: default
7+
data:
8+
config.yaml: |
9+
---
10+
debug: false
11+
appPort: 8080
12+
metricsPort: 8081
13+
db:
14+
user: go
15+
password: devops123
16+
host: postgres.antonputra.pvt
17+
database: mydb
18+
maxConnections: 500
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: go-app
6+
namespace: default
7+
spec:
8+
replicas: 1
9+
strategy:
10+
type: Recreate
11+
selector:
12+
matchLabels:
13+
app: go-app
14+
template:
15+
metadata:
16+
labels:
17+
app: go-app
18+
spec:
19+
terminationGracePeriodSeconds: 0
20+
containers:
21+
- name: go-app
22+
image: aputra/go-app-230:v1
23+
args: [ "-config", "/config.yaml" ]
24+
ports:
25+
- name: http
26+
containerPort: 8080
27+
- name: metrics
28+
containerPort: 8081
29+
env:
30+
- name: GOMAXPROCS
31+
valueFrom:
32+
resourceFieldRef:
33+
resource: limits.cpu
34+
resources:
35+
requests:
36+
memory: 2Gi
37+
cpu: 1500m
38+
limits:
39+
memory: 4Gi
40+
cpu: 2000m
41+
# TODO: Uncomment for use in production.
42+
# readinessProbe:
43+
# httpGet:
44+
# path: /healthz
45+
# port: http
46+
# livenessProbe:
47+
# httpGet:
48+
# path: /healthz
49+
# port: http
50+
volumeMounts:
51+
- name: config
52+
mountPath: /config.yaml
53+
subPath: config.yaml
54+
volumes:
55+
- name: config
56+
configMap:
57+
name: go-app
58+
tolerations:
59+
- effect: NoSchedule
60+
operator: Exists
61+
affinity:
62+
podAffinity:
63+
requiredDuringSchedulingIgnoredDuringExecution:
64+
- labelSelector:
65+
matchExpressions:
66+
- key: app
67+
operator: In
68+
values:
69+
- go-app
70+
topologyKey: "kubernetes.io/hostname"
71+
nodeAffinity:
72+
requiredDuringSchedulingIgnoredDuringExecution:
73+
nodeSelectorTerms:
74+
- matchExpressions:
75+
- key: node
76+
operator: In
77+
values:
78+
- general
79+
- matchExpressions:
80+
- key: kubernetes.io/arch
81+
operator: In
82+
values:
83+
- amd64
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: go-app
6+
namespace: default
7+
spec:
8+
sessionAffinity: ClientIP
9+
ports:
10+
- name: http
11+
port: 8080
12+
targetPort: http
13+
selector:
14+
app: go-app
15+
type: ClusterIP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: go-app
6+
namespace: monitoring
7+
labels:
8+
prometheus: main
9+
spec:
10+
namespaceSelector:
11+
matchNames:
12+
- default
13+
selector:
14+
matchLabels:
15+
app: go-app
16+
podMetricsEndpoints:
17+
- port: metrics
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: go-client
6+
namespace: monitoring
7+
labels:
8+
prometheus: main
9+
spec:
10+
namespaceSelector:
11+
matchNames:
12+
- default
13+
selector:
14+
matchLabels:
15+
app: go-client
16+
podMetricsEndpoints:
17+
- port: metrics

lessons/230/elixir-app/.formatter.exs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[
2+
import_deps: [:ecto, :ecto_sql],
3+
subdirectories: ["priv/*/migrations"],
4+
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}", "priv/*/seeds.exs"]
5+
]

lessons/230/elixir-app/.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Temporary files, for example, from tests.
23+
/tmp/
24+
25+
# Ignore package tarball (built via "mix hex.build").
26+
app-*.tar
27+
28+
!mix.lock

0 commit comments

Comments
 (0)