summaryrefslogtreecommitdiff
path: root/blobs-multiprocess/makefile
blob: a58bb605ee24c274726763a39e4d69ed617438c1 (plain)
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
DIR       = /tmp/blobs
PORT      = 8000
BASE_URI  = http://127.0.0.1:8000
BLOBS_URI = $(BASE_URI)/blobs/user
UUID      = $(shell uuidgen)
PROCS    ?= 4
SIZE     ?= 56

all: multiproc

server:
	python blobs-server.py $(DIR) $(PORT)

multiproc: roundrobin
	python multiproc.py --procs $(PROCS)

roundrobin: kill-haproxy
	/usr/sbin/haproxy -D -f haproxy/roundrobin-$(PROCS).cfg

kill-haproxy:
	-killall -9 haproxy

kill-server:
	pid=$$(ps aux | grep python\ blobs-server.py | grep -v grep | awk "{print \$$2}"); \
	kill -9 $${pid}

data:
	dd if=/dev/urandom of=/tmp/data bs=1024 count=$(SIZE)

list:
	curl -X GET $(BLOBS_URI)/

put: data
	curl -X PUT $(BLOBS_URI)/$(UUID) --data-binary @/tmp/data

get:
	UUID=$(UUID); \
	curl -X PUT $(BLOBS_URI)/$${UUID} --data-binary @/tmp/data; \
	curl -X GET $(BLOBS_URI)/$${UUID} > /dev/null

delete:
	UUID=$(UUID); \
	curl -X PUT $(BLOBS_URI)/$${UUID} --data-binary @/tmp/data; \
	curl -X DELETE $(BLOBS_URI)/$${UUID}

stress-baseline-ab: clean
	ab -c 10 -n 1000 http://127.0.0.1:8000/

stress-baseline: clean
	siege --concurrent=50 -t 5s http://127.0.0.1:8000/

stress-put: clean
	#ab -c 10 -n 1000 -T /tmp/data $(BLOBS_URI)/$(UUID)
	ab -c 10 -n 1000 -T /tmp/data $(BLOBS_URI)/$(UUID)

stress-get:
	@ab -c 10 -n 1000 -q $(BASE_URI)/ | grep ^Requests | awk '{print $$4}'

ab-get:
	@ab -c 10 -n 1000 -q -m GET $(URI) | grep ^Requests | awk '{print $$4}'

ab-put:
	@ab -c 10 -n 1000 -q -u /tmp/data $(URI) | grep ^Requests | awk '{print $$4}'

ab-flag:
	@ab -c 10 -n 1000 -q -p /tmp/flag $(URI) | grep ^Requests | awk '{print $$4}'

ab-delete:
	@ab -c 10 -n 1000 -q -m DELETE $(URI) | grep ^Requests | awk '{print $$4}'

clean:
	rm -rf /tmp/blobs/*

flag:
	echo '["PROCESSING"]' > /tmp/flag


.PHONY: server multiproc roundrobin kill-server kill-haproxy