forked from sieve-microservices/sharelatex-loadgenerator
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcpu_scale.tick
45 lines (41 loc) · 1.01 KB
/
cpu_scale.tick
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
var cpu_percentile = stream
|from()
.measurement('docker_container_cpu')
.where(lambda: "container_image" =~ /sharelatex-web/ AND "cpu" == 'cpu-total')
|window()
.period(30s)
.every(1s)
|mean('usage_percent')
|log()
var scale_out = cpu_percentile
@scale()
.simulate(FALSE)
.debug(TRUE)
.name('web')
.when('mean > 20')
.by('current + 1')
.min_instances(1)
.max_instances(10)
.cooldown('20s')
var scale_in = cpu_percentile
@scale()
.simulate(FALSE)
.debug(TRUE)
.name('web')
.when('mean < 2')
.by('current - 1')
.min_instances(1)
.max_instances(10)
.cooldown('20s')
scale_out
|influxDBOut()
.database('metrics')
.measurement('autoscaling')
.flushInterval(1d)
.buffer(1)
scale_in
|influxDBOut()
.database('metrics')
.measurement('autoscaling')
.flushInterval(1d)
.buffer(1)