diff --git a/tools/bench/lsqb.sh b/tools/bench/lsqb.sh new file mode 100644 index 0000000..a209ba9 --- /dev/null +++ b/tools/bench/lsqb.sh @@ -0,0 +1,188 @@ +#!/bin/bash +# +# Benchmark QUIC using LSQUIC http_client and other HTTP Benchmark tools. + +# Variables +CLIENT_TYPE='' +CLIENT_PATH='http_client' +CLIENTS='1' +TRIALS='1' +HOST='www.example.com' +IP='192.168.0.1' +IP_PORT='192.168.0.1:8000' +REQ_PATH='/' +QUIC_VERSION='Q043' +CLIENT_OPTIONS='none' +IGNORE_OUT='' +REQUESTS='1' +CONNS='1' +MAXREQS='1' + +function usage() { +cat < /dev/null +} + +function run_h2load() { + h2load -n ${REQUESTS} -c ${CONNS} -m ${CONNS} \ + https://${IP_PORT}/${REQ_PATH} > /dev/null +} + +function run_client() { + if [[ "${CLIENT_OPTIONS}" == 'none' ]]; then + CLIENT_OPTIONS='' + fi + ${CLIENT_PATH} ${IGNORE_OUT} \ + -H ${HOST} -s ${IP_PORT} \ + -p ${REQ_PATH} \ + -S rcvbuf=$[2000 * 2048] \ + -o support_tcid0=0 \ + -o version=${QUIC_VERSION} \ + ${CLIENT_OPTIONS} \ + -n ${CONNS} -r ${REQUESTS} -R ${MAXREQS} -w ${CONCUR} +} + +function run_trials() { + printf '\n' + for (( i = 0; i < ${TRIALS}; i++ )); do + START_TIME=$(date +%s.%3N) + if [[ "${CLIENT_TYPE}" == 'curl' ]]; then + for (( j = 0; j < ${CLIENTS}; j++ )); do + run_curl & + done + elif [[ "${CLIENT_TYPE}" == 'curl-caddy' ]]; then + for (( j = 0; j < ${CLIENTS}; j++ )); do + run_curl_caddy & + done + elif [[ "${CLIENT_TYPE}" == 'ab' ]]; then + for (( j = 0; j < ${CLIENTS}; j++ )); do + run_ab & + done + elif [[ "${CLIENT_TYPE}" == 'h2load' ]]; then + for (( j = 0; j < ${CLIENTS}; j++ )); do + run_h2load & + done + else + for (( j = 0; j < ${CLIENTS}; j++ )); do + run_client & + done + fi + wait + END_TIME=$(date +%s.%3N) + ELAPSED_TIME=$(awk "BEGIN {print ${END_TIME}-${START_TIME}}") + printf ' %s, ' "${ELAPSED_TIME}" + done + printf '\n\n' +} + +function main() { + check_input "$@" + run_trials +} + +main "$@"