Skip to content

Commit cc02ea1

Browse files
committed
- add http1term tests for siege client
1 parent 67ed709 commit cc02ea1

File tree

2 files changed

+60
-29
lines changed

2 files changed

+60
-29
lines changed

bench-scripts/bench_config_haproxy.sh

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ HAPROXY_BUILD_TARG=${BENCH_HAPROXY_BUILD_TARG:-'linux-glibc'}
2020
CERT_SUBJ=${BENCH_CERT_SUBJ:-'/CN=localhost'}
2121
CERT_ALT_SUBJ=${BENCH_CERT_ALT_SUBJ:-'subjectAltName=DNS:localhost,IP:127.0.0.1'}
2222
HOST=${BENCH_HOST:-'127.0.0.1'}
23+
HTTPTERM_HOST=${BENCH_HTTPTERM_HOST:-${HOST}}
24+
HTTPTERM_PORT=${BENCH_HTTPTERM_PORT:-9000}
2325
PORT_RSA_REUSE=${BENCH_PORT_RSA_REUSE:-7000}
2426
PORT_RSA=${BENCH_PORT_RSA:-7100}
2527
PORT_EC_REUSE=${BENCH_PORT_EC_REUSE:-7200}
@@ -32,12 +34,7 @@ HOST=${BENCH_HOST:-'127.0.0.1'}
3234

3335
function install_httpterm {
3436
typeset SSL_LIB=$1
35-
#
36-
# FixMe: with https://github.com/wtarreau/httpterm,
37-
# once https://github.com/wtarreau/httpterm/pull/1
38-
# will be merged
39-
#
40-
typeset HTTPTERM_REPO="https://github.com/sashan/httpterm"
37+
typeset HTTPTERM_REPO="https://github.com/wtarreau/httpterm"
4138
typeset BASENAME='httpterm'
4239
typeset DIRNAME="${BASENAME}"
4340
typeset SSL_CFLAGS=''
@@ -72,7 +69,7 @@ function install_h1load {
7269
# adjust flags for wolfssl
7370
#
7471
SSL_CFLAGS="-I${INSTALL_ROOT}/${SSL_LIB}/include/wolfssl"
75-
SSL_CFLAGS="${SSL_CFLAGS} -I${INSTALL_ROOT}/${SSL_LIB}/include"
72+
SSL_CFLAGS="${SSL_CFLAGS} -I${INSTALL_ROOT}/${SSL_LIB}/include"
7673
SSL_CFLAGS="${SSL_CFLAGS} -include ${INSTALL_ROOT}/${SSL_LIB}/include/wolfssl/options.h"
7774
SSL_LFLAGS="-L ${INSTALL_ROOT}/${SSL_LIB}/lib -lwolfssl -Wl,-rpath=${INSTALL_ROOT}/lib"
7875
else
@@ -107,7 +104,7 @@ function install_haproxy {
107104

108105
case ${SSL_LIB} in
109106
wolf*)
110-
USE_LIB='USE_OPENSSL_WOLFSSL=1'
107+
USE_LIB='USE_OPENSSL_WOLFSSL=1'
111108
;;
112109
*)
113110
USE_LIB='USE_OPENSSL=1'
@@ -168,6 +165,9 @@ function config_haproxy {
168165
typeset PORT=''
169166
typeset SSL_REUSE=''
170167
typeset REUSE_LABEL=''
168+
typeset HAPROXY_SERVER='http-request return status 200 content-type "text/plain" string "it works"'
169+
typeset HTTPTERM_SERVER="server next ${HTTPTERM_HOST}:${HTTPTERM_PORT}"
170+
typeset SERVER=''
171171

172172
if [[ -z "${SSL_LIB}" ]] ; then
173173
SSL_LIB='openssl-=master'
@@ -187,20 +187,29 @@ global
187187
ssl-server-verify none
188188
189189
EOF
190-
191-
for BASEPORT in ${PORT_RSA_REUSE} ${PORT_RSA} ${PORT_EC_REUSE} ${PORT_EC} ; do
192-
if [[ ${BASEPORT} -eq ${PORT_RSA_REUSE} || ${BASEPORT} -eq ${PORT_RSA} ]] ; then
193-
PROXYCERT=${RSACERTKEY}
194-
else
195-
PROXYCERT=${ECCERTKEY}
196-
fi
197-
if [[ ${BASEPORT} -eq ${PORT_RSA_REUSE} || ${BASEPORT} -eq ${PORT_EC_REUSE} ]] ; then
198-
SSL_REUSE=''
199-
REUSE_LABEL='ssl-reuse'
190+
for i in `seq 2` ; do
191+
if [[ ${i} -eq 1 ]] ; then
192+
SERVER=${HAPROXY_SERVER}
200193
else
201-
SSL_REUSE='no-ssl-reuse'
202-
REUSE_LABEL='no-ssl-reuse'
194+
SERVER=${HTTPTERM_SERVER}
195+
PORT_RSA_REUSE=$(( ${PORT_RSA_REUSE} + 1000))
196+
PORT_RSA=$(( ${PORT_RSA} + 1000))
197+
PORT_EC_REUSE=$(( ${PORT_EC_REUSE} + 1000))
198+
PORT_EC=$(( ${PORT_EC} + 1000))
203199
fi
200+
for BASEPORT in ${PORT_RSA_REUSE} ${PORT_RSA} ${PORT_EC_REUSE} ${PORT_EC} ; do
201+
if [[ ${BASEPORT} -eq ${PORT_RSA_REUSE} || ${BASEPORT} -eq ${PORT_RSA} ]] ; then
202+
PROXYCERT=${RSACERTKEY}
203+
else
204+
PROXYCERT=${ECCERTKEY}
205+
fi
206+
if [[ ${BASEPORT} -eq ${PORT_RSA_REUSE} || ${BASEPORT} -eq ${PORT_EC_REUSE} ]] ; then
207+
SSL_REUSE=''
208+
REUSE_LABEL='ssl-reuse'
209+
else
210+
SSL_REUSE='no-ssl-reuse'
211+
REUSE_LABEL='no-ssl-reuse'
212+
fi
204213
cat <<EOF >> ${HAPROXY_CONF}
205214
defaults ${REUSE_LABEL}
206215
mode http
@@ -216,8 +225,8 @@ frontend port${BASEPORT}
216225
http-request return status 200 content-type "text/plain" string "it works"
217226
218227
EOF
219-
BASEPORT=$(( ${BASEPORT} + 1))
220-
TOPPORT=$(( ${BASEPORT} + ${PROXY_CHAIN} - 1 ))
228+
BASEPORT=$(( ${BASEPORT} + 1))
229+
TOPPORT=$(( ${BASEPORT} + ${PROXY_CHAIN} - 1 ))
221230
cat <<EOF >> ${HAPROXY_CONF}
222231
listen port${BASEPORT}
223232
bind :${BASEPORT} ssl crt ${PROXYCERT}
@@ -226,14 +235,15 @@ listen port${BASEPORT}
226235
227236
EOF
228237

229-
BASEPORT=$(( ${BASEPORT} + 1))
230-
for PORT in $(seq ${BASEPORT} ${TOPPORT}) ; do
238+
BASEPORT=$(( ${BASEPORT} + 1))
239+
for PORT in $(seq ${BASEPORT} ${TOPPORT}) ; do
231240
cat <<EOF >> ${HAPROXY_CONF}
232241
listen port${PORT}
233242
bind :${PORT} ssl crt ${PROXYCERT}
234243
server next ${HOST}:$(( ${PORT} - 1))
235244
236245
EOF
246+
done
237247
done
238248
done
239249
gen_certkey ${RSACERTKEY} ${RSACERTKEY}.key
@@ -248,6 +258,7 @@ function setup_tests {
248258
install_haproxy openssl-master
249259
install_httpterm openssl-master
250260
install_h1load openssl-master
261+
install_siege openssl-master
251262
config_haproxy openssl-master
252263
clean_build
253264

@@ -257,6 +268,7 @@ function setup_tests {
257268
install_haproxy openssl-$i
258269
install_httpterm openssl-$i
259270
install_h1load openssl-$i
271+
install_siege openssl-$1
260272
config_haproxy openssl-$i
261273
clean_build
262274
done
@@ -266,6 +278,7 @@ function setup_tests {
266278
install_haproxy OpenSSL_1_1_1-stable
267279
install_httpterm OpenSSL_1_1_1-stable
268280
install_h1load OpenSSL_1_1_1-stable
281+
install_siege OpenSSL_1_1_1-stable
269282
config_haproxy OpenSSL_1_1_1-stable
270283
clean_build
271284

@@ -274,6 +287,7 @@ function setup_tests {
274287
install_haproxy wolfssl-5.8.2
275288
install_httpterm wolfssl-5.8.2
276289
install_h1load wolfssl-5.8.2
290+
install_siege wolfssl-5.8.2
277291
config_haproxy wolfssl-5.8.2
278292
clean_build
279293

@@ -282,6 +296,7 @@ function setup_tests {
282296
install_haproxy libressl-4.1.0
283297
install_httpterm libressl-4.1.0
284298
install_h1load libressl-4.1.0
299+
install_siege libressl-4.1.0
285300
config_haproxy libressl-4.1.0
286301
clean_build
287302

@@ -301,6 +316,7 @@ function setup_tests {
301316
install_haproxy aws-lc
302317
install_httpterm aws-lc
303318
install_h1load aws-lc
319+
install_siege aws-lc
304320
config_haproxy aws-lc
305321
clean_build aws-lc
306322
}

bench-scripts/bench_run_haproxy.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ INSTALL_ROOT=${BENCH_INSTALL_ROOT:-"/tmp/bench.binaries"}
1414
RESULT_DIR=${BENCH_RESULTS:-"${INSTALL_ROOT}/results"}
1515
PORT_RSA_REUSE=${BENCH_PORT_RSA_REUSE:-7000}
1616
PORT_RSA=${BENCH_PORT_RSA:-7100}
17+
SIEGE_PORT_RSA=$(( ${PORT_RSA} + 1000 ))
1718
PORT_EC_REUSE=${BENCH_PORT_EC_REUSE:-7200}
1819
PORT_EC=${BENCH_PORT_EC:-7300}
20+
SIEGE_PORT_EC=$(( ${PORT_EC} + 1000 ))
1921
HOST=${BENCH_HOST:-'127.0.0.1'}
2022
CERT_SUBJ=${BENCH_CERT_SUBJ:-'/CN=localhost'}
2123
CERT_ALT_SUBJ=${BENCH_CERT_ALT_SUBJ:-'subjectAltName=DNS:localhost,IP:127.0.0.1'}
@@ -59,6 +61,7 @@ function run_test {
5961
typeset THREAD_COUNT=$2
6062
typeset OPENSSL_DIR=${INSTALL_ROOT}/${SSL_LIB}
6163
typeset H1LOAD=${OPENSSL_DIR}/bin/h1load
64+
typeset SIEGE=${OPENSSL_DIR}/bin/siege
6265
typeset BASE_URL="https://${HOST}:"
6366
typeset RESULT=''
6467
typeset HAPPIDFILE=${OPENSSL_DIR}/haproxy.pid
@@ -67,7 +70,7 @@ function run_test {
6770
run_haproxy ${SSL_LIB} ${HAPPIDFILE}
6871

6972
echo "proxy running for ${SSL_LIB} ${THREAD_COUNT}"
70-
RESULT=${RESULT_DIR}/run-dh-rsa-reuse-${THREAD_COUNT}-${SSL_LIB}.out
73+
RESULT=${RESULT_DIR}/h1load-dh-rsa-reuse-${THREAD_COUNT}-${SSL_LIB}.out
7174
PORT=$(( ${PORT_RSA_REUSE} + ${PROXY_CHAIN} ))
7275
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${H1LOAD} \
7376
-l \
@@ -78,8 +81,8 @@ function run_test {
7881
-u \
7982
--tls-reuse \
8083
${BASE_URL}${PORT} > ${RESULT} || exit 1
81-
82-
RESULT=${RESULT_DIR}/run-dh-rsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
84+
85+
RESULT=${RESULT_DIR}/h1load-dh-rsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
8386
PORT=$(( ${PORT_RSA} + ${PROXY_CHAIN} ))
8487
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${H1LOAD} \
8588
-l \
@@ -90,7 +93,13 @@ function run_test {
9093
-u \
9194
${BASE_URL}${PORT} > ${RESULT} || exit 1
9295

93-
RESULT=${RESULT_DIR}/run-ec-dsa-reuse-${THREAD_COUNT}-${SSL_LIB}.out
96+
RESULT=${RESULT_DIR}/siege-dh-rsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
97+
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${SIEGE}
98+
-b \
99+
-c ${THREAD_COUNT} \
100+
-t ${TEST_TIME}S ${BASE_URL}:${SIEGE_PORT_RSA} 2> ${RESULT}
101+
102+
RESULT=${RESULT_DIR}/h1load-ec-dsa-reuse-${THREAD_COUNT}-${SSL_LIB}.out
94103
PORT=$(( ${PORT_EC_REUSE} + ${PROXY_CHAIN} ))
95104
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${H1LOAD} \
96105
-l \
@@ -102,7 +111,7 @@ function run_test {
102111
--tls-reuse \
103112
${BASE_URL}${PORT} > ${RESULT} || exit 1
104113

105-
RESULT=${RESULT_DIR}/run-ec-dsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
114+
RESULT=${RESULT_DIR}/h1load-ec-dsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
106115
PORT=$(( ${PORT_EC} + ${PROXY_CHAIN} ))
107116
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${H1LOAD} \
108117
-l \
@@ -113,6 +122,12 @@ function run_test {
113122
-u \
114123
${BASE_URL}${PORT} > ${RESULT} || exit 1
115124

125+
RESULT=${RESULT_DIR}/siege-ec-dsa-noreuse-${THREAD_COUNT}-${SSL_LIB}.out
126+
LD_LIBRARY_PATH=${OPENSSL_DIR}/lib ${SIEGE}
127+
-b \
128+
-c ${THREAD_COUNT} \
129+
-t ${TEST_TIME}S ${BASE_URL}:${SIEGE_PORT_EC} 2> ${RESULT}
130+
116131
kill_haproxy ${HAPPIDFILE}
117132
}
118133

0 commit comments

Comments
 (0)