forked from tarantool/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
265 lines (221 loc) · 7.5 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
NETWORK="tnt-kafka-tests"
docker-remove-network:
docker network remove ${NETWORK} || true
docker-create-network: docker-remove-network
docker network create ${NETWORK}
docker-remove-zoo:
docker rm -f zookeeper || true
docker-run-zoo: docker-remove-zoo
docker run -d \
--net=${NETWORK} \
--name=zookeeper \
-p 2181:2181 \
-e ZOOKEEPER_CLIENT_PORT=2181 \
confluentinc/cp-zookeeper:5.0.0
docker-remove-kafka:
docker rm -f kafka || true
docker-pull-kafka:
docker pull wurstmeister/kafka
docker-run-kafka: docker-remove-kafka
docker run -d \
--net=${NETWORK} \
--name=kafka \
-p 9092:9092 \
-e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \
-e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
wurstmeister/kafka
docker-read-topic-data:
docker run \
--net=${NETWORK} \
--rm \
confluentinc/cp-kafka:5.0.0 \
kafka-console-consumer --bootstrap-server kafka:9092 --topic test_partially_unsubscribe_1 --from-beginning
APP_NAME = kafka-test
APP_IMAGE = kafka-test-image
docker-build-app:
docker build -t ${APP_IMAGE} -f ./docker/Dockerfile .
docker-remove-app:
docker rm -f ${APP_NAME} || true
docker-run-app: docker-build-app docker-remove-app
docker run -d \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE}
docker-run-interactive: docker-build-app docker-remove-app
docker run -it \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE}
docker-remove-all: \
docker-remove-app \
docker-remove-kafka \
docker-remove-zoo \
docker-remove-network
docker-run-environment: \
docker-remove-all \
docker-create-network \
docker-run-zoo \
docker-run-kafka
docker-run-all: \
docker-run-environment \
docker-create-network \
docker-build-app \
docker-run-app
#######################################################################
# Tests
tests-dep:
cd ./tests && \
python3 -m venv venv && \
. venv/bin/activate && \
pip install -r requirements.txt && \
deactivate
tests-run:
cd ./tests && \
. venv/bin/activate && \
pytest -W ignore -vv && \
deactivate
test-sleep: tests-dep docker-run-all
sleep 10
test-run-with-docker: test-sleep
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_producer --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_consume --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_unsubscribe --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_unsub_partially_1 --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_unsub_partially_2 --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_multi_consume_1 --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_multi_consume_2 --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic test_consuming_from_last_committed_offset --partitions 1 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
sleep 5
cd ./tests && \
python3 -m venv venv && \
. venv/bin/activate && \
pip install -r requirements.txt && \
deactivate
cd ./tests && \
. venv/bin/activate && \
pytest -W ignore -vv && \
deactivate
#######################################################################
# Benchmarks
docker-create-benchmark-async-producer-topic:
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic async_producer_benchmark --partitions 2 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker-run-benchmark-async-producer-interactive: docker-build-app docker-remove-app
docker run -it \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
--entrypoint "tarantool" \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE} \
/opt/tarantool/benchmarks/async_producer.lua
docker-read-benchmark-async-producer-topic-data:
docker run \
--net=${NETWORK} \
--rm \
confluentinc/cp-kafka:5.0.0 \
kafka-console-consumer --bootstrap-server kafka:9092 --topic async_producer_benchmark --from-beginning
docker-create-benchmark-sync-producer-topic:
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic sync_producer_benchmark --partitions 2 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker-run-benchmark-sync-producer-interactive: docker-build-app docker-remove-app
docker run -it \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
--entrypoint "tarantool" \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE} \
/opt/tarantool/benchmarks/sync_producer.lua
docker-read-benchmark-sync-producer-topic-data:
docker run \
--net=${NETWORK} \
--rm \
confluentinc/cp-kafka:5.0.0 \
kafka-console-consumer --bootstrap-server kafka:9092 --topic sync_producer_benchmark --from-beginning
docker-create-benchmark-auto-offset-store-consumer-topic:
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic auto_offset_store_consumer_benchmark --partitions 2 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker-run-benchmark-auto-offset-store-consumer-interactive: docker-build-app docker-remove-app
docker run -it \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
--entrypoint "tarantool" \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE} \
/opt/tarantool/benchmarks/auto_offset_store_consumer.lua
docker-read-benchmark-auto-offset-store-consumer-topic-data:
docker run \
--net=${NETWORK} \
--rm \
confluentinc/cp-kafka:5.0.0 \
kafka-console-consumer --bootstrap-server kafka:9092 --topic auto_offset_store_consumer_benchmark --from-beginning
docker-create-benchmark-manual-commit-consumer-topic:
docker run \
--net=${NETWORK} \
--rm confluentinc/cp-kafka:5.0.0 \
kafka-topics --create --topic manual_offset_store_consumer --partitions 2 --replication-factor 1 \
--if-not-exists --zookeeper zookeeper:2181
docker-run-benchmark-manual-commit-consumer-interactive: docker-build-app docker-remove-app
docker run -it \
-p 3301:3301 \
--net ${NETWORK} \
--name ${APP_NAME} \
--entrypoint "tarantool" \
-e KAFKA_BROKERS=kafka:9092 \
${APP_IMAGE} \
/opt/tarantool/benchmarks/manual_offset_store_consumer.lua
docker-read-benchmark-manual-commit-consumer-topic-data:
docker run \
--net=${NETWORK} \
--rm \
confluentinc/cp-kafka:5.0.0 \
kafka-console-consumer --bootstrap-server kafka:9092 --topic manual_offset_store_consumer --from-beginning