-
Notifications
You must be signed in to change notification settings - Fork 9
342 lines (342 loc) · 12.6 KB
/
test.yaml
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
---
# @see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
# Services feature of GitHub Actions isn't fit for our purposes for testing.
# We cannot overwrite arguments of ENTRYPOINT.
# @see https://docs.docker.com/engine/reference/commandline/create/#options
#
# @see https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
defaults:
run:
shell: bash
jobs:
main:
name: Main
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
include:
- {redis: '7.2', ruby: '3.3'}
- {redis: '7.2', ruby: '3.3', compose: compose.ssl.yaml}
- {redis: '7.2', ruby: '3.3', driver: 'hiredis'}
- {redis: '7.2', ruby: '3.3', driver: 'hiredis', compose: compose.ssl.yaml}
- {redis: '7.2', ruby: '3.3', compose: compose.replica.yaml, replica: '2'}
- {task: test_cluster_state, pattern: 'PrimaryOnly', compose: compose.valkey.yaml, redis: '8', replica: '2', startup: '9'}
- {task: test_cluster_state, pattern: 'Pooled', compose: compose.valkey.yaml, redis: '8', replica: '2', startup: '9'}
- {task: test_cluster_state, pattern: 'ScaleReadRandom', compose: compose.valkey.yaml, redis: '8', replica: '2', startup: '9'}
- {task: test_cluster_state, pattern: 'ScaleReadRandomWithPrimary', compose: compose.valkey.yaml, redis: '8', replica: '2', startup: '9'}
- {task: test_cluster_state, pattern: 'ScaleReadLatency', compose: compose.valkey.yaml, redis: '8', replica: '2', startup: '9'}
- {redis: '8', ruby: '3.3', compose: compose.valkey.yaml, replica: '2'}
- {redis: '7.2', ruby: '3.2', compose: compose.auth.yaml}
- {redis: '7.0', ruby: '3.1'}
- {redis: '6.2', ruby: '3.0'}
- {redis: '5.0', ruby: '2.7'}
- {task: test_cluster_down}
- {task: test_cluster_broken, restart: 'no', startup: '6'}
- {ruby: 'jruby'}
- {ruby: 'truffleruby'}
- {task: test_cluster_scale, pattern: 'Single', compose: compose.scale.yaml, startup: '8'}
- {task: test_cluster_scale, pattern: 'Pipeline', compose: compose.scale.yaml, startup: '8'}
- {task: test_cluster_scale, pattern: 'Transaction', compose: compose.scale.yaml, startup: '8'}
- {task: test_cluster_scale, pattern: 'PubSub', compose: compose.scale.yaml, startup: '8'}
env:
REDIS_VERSION: ${{ matrix.redis || '7.2' }}
DOCKER_COMPOSE_FILE: ${{ matrix.compose || 'compose.yaml' }}
REDIS_CONNECTION_DRIVER: ${{ matrix.driver || 'ruby' }}
REDIS_REPLICA_SIZE: ${{ matrix.replica || '1' }}
RESTART_POLICY: ${{ matrix.restart || 'always' }}
REDIS_CLIENT_MAX_STARTUP_SAMPLE: ${{ matrix.startup || '3' }}
TEST_CLASS_PATTERN: ${{ matrix.pattern || '' }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby || '3.3' }}
bundler-cache: true
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
- name: Wait for Redis cluster to be ready
run: bundle exec rake wait
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Run minitest
run: bundle exec rake ${{ matrix.task || 'test' }}
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true
nat-ted-env:
name: NAT-ted Environments
timeout-minutes: 5
runs-on: ubuntu-latest
env:
REDIS_VERSION: '7.2'
DOCKER_COMPOSE_FILE: 'compose.nat.yaml'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Get IP address of host
run: |
host_ip_addr=$(ip a | grep eth0 | grep inet | awk '{print $2}' | cut -d'/' -f1)
echo "HOST_IP_ADDR=$host_ip_addr" >> $GITHUB_ENV
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
env:
HOST_ADDR: ${{ env.HOST_IP_ADDR }}
- name: Wait for nodes to be ready
run: |
node_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'length')
i=0
while :
do
if [[ $i -gt $MAX_ATTEMPTS ]]
then
echo "Max attempts exceeded: $i times"
exit 1
fi
healthy_cnt=$(docker compose -f $DOCKER_COMPOSE_FILE ps --format json | jq -s 'map(select(.Health == "healthy")) | length')
if [[ $healthy_cnt -eq $node_cnt ]]
then
break
fi
echo 'Waiting for nodes to be ready...'
sleep 3
: $((++i))
done
env:
MAX_ATTEMPTS: "10"
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Build cluster
run: bundle exec rake "build_cluster[$HOST_ADDR]"
env:
HOST_ADDR: ${{ env.HOST_IP_ADDR }}
DEBUG: "1"
- name: Run minitest
run: bundle exec rake test
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true
lint:
name: Lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop
benchmark:
name: Benchmark
timeout-minutes: 10
runs-on: ubuntu-latest
env:
REDIS_VERSION: '7.2'
DOCKER_COMPOSE_FILE: 'compose.latency.yaml'
REDIS_REPLICA_SIZE: '2'
REDIS_CLIENT_MAX_THREADS: '10'
DELAY_TIME: '1ms'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
- name: Wait for Redis cluster to be ready
run: bundle exec rake wait
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Rebuild cluster for balancing of replicas
run: bundle exec rake build_cluster_for_bench
env:
DEBUG: '1'
- name: Print topology
run: |
for i in {1..9}
do
echo "node$i: $(docker compose -f $DOCKER_COMPOSE_FILE exec node$i redis-cli cluster nodes | grep myself)"
done
- name: Ping nodes
run: |
for i in {1..9}
do
node_addr="$(docker compose -f $DOCKER_COMPOSE_FILE exec node$i redis-cli cluster nodes | grep myself | awk '{print $2}' | cut -d'@' -f1 | cut -d':' -f1)"
echo "node$i:"
ping -c 5 $node_addr
done
- name: Print cpu info
run: grep 'model name' /proc/cpuinfo
- name: Print memory info
run: free -w
- name: Print disk info
run: df -h
- name: Run minitest
run: bundle exec rake bench | grep BenchCommand | grep -v 'Envoy#bench_pipeline_echo\|Envoy#bench_single_echo' | sort
- name: Reset qdisc
run: |
for i in {5..9..2}
do
docker compose -f $DOCKER_COMPOSE_FILE exec node$i tc qdisc del dev eth0 root netem || true
done
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true
ips:
name: IPS
timeout-minutes: 10
runs-on: ubuntu-latest
env:
REDIS_VERSION: '7.2'
DOCKER_COMPOSE_FILE: 'compose.latency.yaml'
REDIS_REPLICA_SIZE: '2'
REDIS_CLIENT_MAX_THREADS: '10'
DELAY_TIME: '0ms'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
- name: Wait for Redis cluster to be ready
run: bundle exec rake wait
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Print cpu info
run: grep 'model name' /proc/cpuinfo
- name: Run iteration per second
run: bundle exec rake ips
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true
profiling:
name: Profiling
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode:
- single
- excessive_pipelining
- pipelining_in_moderation
- original_mget
- emulated_mget
env:
REDIS_VERSION: '7.2'
DOCKER_COMPOSE_FILE: 'compose.yaml'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
- name: Wait for Redis cluster to be ready
run: bundle exec rake wait
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Run profiler
run: bundle exec rake prof
env:
PROFILE_MODE: ${{ matrix.mode }}
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true
massive:
name: Massive Cluster
timeout-minutes: 10
runs-on: ubuntu-latest
env:
REDIS_VERSION: '7.2'
DOCKER_COMPOSE_FILE: 'compose.massive.yaml'
REDIS_SHARD_SIZE: '10'
REDIS_REPLICA_SIZE: '2'
REDIS_CLIENT_MAX_STARTUP_SAMPLE: '5'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Print user limits
run: ulimit -a
- name: Print kernel params
run: |
sysctl fs.file-max
sysctl vm.swappiness
sysctl vm.overcommit_memory
sysctl net.ipv4.tcp_sack
sysctl net.ipv4.tcp_timestamps
sysctl net.ipv4.tcp_window_scaling
sysctl net.ipv4.tcp_congestion_control
sysctl net.ipv4.tcp_syncookies
sysctl net.ipv4.tcp_tw_reuse
sysctl net.ipv4.tcp_max_syn_backlog
sysctl net.core.somaxconn
sysctl net.core.rmem_max
sysctl net.core.wmem_max
- name: Tune kernel params for redis
run: |
# https://developer.redis.com/operate/redis-at-scale/talking-to-redis/initial-tuning/
sudo sysctl -w vm.overcommit_memory=1
sudo sysctl -w net.ipv4.tcp_tw_reuse=1 # reuse sockets quickly
sudo sysctl -w net.ipv4.tcp_max_syn_backlog=1024 # backlog setting
sudo sysctl -w net.core.somaxconn=1024 # up the number of connections per port
- name: Pull Docker images
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE pull
- name: Run containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE up -d
- name: Print memory info
run: free -w
- name: Wait for Redis cluster to be ready
run: bundle exec rake wait
env:
DEBUG: '1'
- name: Print containers
run: docker compose -f $DOCKER_COMPOSE_FILE ps
- name: Run profiler
run: bundle exec rake prof
env:
PROFILE_MODE: pipelining_in_moderation
- name: Stop containers
run: docker compose --progress quiet -f $DOCKER_COMPOSE_FILE down || true