forked from anacarolinacastro/simple-video-cdn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (37 loc) · 2.08 KB
/
Makefile
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
.PHONY: benchmark
CACHE_PORTS_RANGE ?= 8090-8091
CACHE_POOL_SIZE ?= 2
LB_ALGORITM ?= round_robin
SIGNALS ?= 5
NODES ?= 100
REPLICAS_PER_CACHE ?= 4
available-algoritms:
@echo random round_robin least_conn consistent_hash consistent_hash_bound_load
build-origin:
docker build -t nginx-rtmp .
run-origin: build-origin
docker run -it -p 1935:1935 -p 8080:8080 --rm nginx-rtmp
build:
LB_ALGORITM=$(LB_ALGORITM) CACHE_PORTS_RANGE=$(CACHE_PORTS_RANGE) docker-compose build
run: build
NODES=$(NODES) CACHE_POOL_SIZE=$(CACHE_POOL_SIZE) REPLICAS_PER_CACHE=$(REPLICAS_PER_CACHE) LB_ALGORITM=$(LB_ALGORITM) CACHE_PORTS_RANGE=$(CACHE_PORTS_RANGE) docker-compose up --scale cache=$(CACHE_POOL_SIZE)
lint:
NODES=$(NODES) REPLICAS_PER_CACHE=$(REPLICAS_PER_CACHE) LB_ALGORITM=$(LB_ALGORITM) CACHE_PORTS_RANGE=$(CACHE_PORTS_RANGE) docker-compose run --rm lint
down:
NODES=$(NODES) REPLICAS_PER_CACHE=$(REPLICAS_PER_CACHE) LB_ALGORITM=$(LB_ALGORITM) CACHE_PORTS_RANGE=$(CACHE_PORTS_RANGE) docker-compose down
ingest:
docker run --net="host" --rm -v $(shell pwd):/files jrottenberg/ffmpeg:4.1 -hide_banner \
-re -f lavfi -i "testsrc2=size=1280x720:rate=30" -pix_fmt yuv420p \
-c:v libx264 -x264opts keyint=30:min-keyint=30:scenecut=-1 \
-tune zerolatency -profile:v high -preset veryfast -bf 0 -refs 3 \
-b:v 1400k -bufsize 1400k \
-vf "drawtext=fontfile='/files/fonts/OpenSans-Bold.ttf':text='%{localtime}:box=1:fontcolor=black:boxcolor=white:fontsize=100':x=40:y=400'" \
-utc_timing_url "https://time.akamai.com/?iso" -use_timeline 0 -media_seg_name 'chunk-stream-$RepresentationID$-$Number%05d$.m4s' \
-init_seg_name 'init-stream1-$RepresentationID$.m4s' \
-window_size 5 -extra_window_size 10 -remove_at_exit 1 -adaptation_sets "id=0,streams=v id=1,streams=a" -f mpegts http://127.0.0.1:8080/ingest/signal-1
benchmark:
./benchmark.sh $(LB_ALGORITM) $(SIGNALS)
build-plot:
docker build results -t vts-plot
plot:build-plot
docker run --env LB_ALGORITM=$(LB_ALGORITM) --env CACHE_PORTS_RANGE=$(CACHE_PORTS_RANGE) -it -v $(PWD)/results:/files --network host --rm vts-plot