@@ -53,20 +53,17 @@ set -x
5353#
5454
5555INSTALL_ROOT=${BENCH_INSTALL_ROOT:- " /tmp/bench.binaries" }
56- RESULT_DIR=${BENCH_RESULTS:- " ${INSTALL_ROOT} /results" }
5756WORKSPACE_ROOT=${BENCH_WORKSPACE_ROOT:- " /tmp/bench.workspace" }
5857MAKE_OPTS=${BENCH_MAKE_OPTS}
5958HTTPS_PORT=${BENCH_HTTPS_PORT:- ' 4430' }
6059HTTP_PORT=${BENCH_HTTP_PORT:- ' 8080' }
6160CERT_SUBJ=${BENCH_CERT_SUBJ:- ' /CN=localhost' }
6261CERT_ALT_SUBJ=${BENCH_CERT_ALT_SUBJ:- ' subjectAltName=DNS:localhost,IP:127.0.0.1' }
63- TEST_TIME=${BENCH_TEST_TIME:- ' 5M' }
6462HOST=${BENCH_HOST:- ' 127.0.0.1' }
6563APACHE_VERSION=' 2.4.65'
66- HAPROXY=' no'
6764
6865. ./common_util.sh
69- . ./haproxy_bench .sh
66+ . ./bench_config_haproxy .sh
7067
7168function install_wolfssl_for_apache {
7269 typeset VERSION=$1
@@ -744,183 +741,6 @@ function config_apache {
744741 generate_download_files " ${INSTALL_ROOT} /${SSL_LIB} /htdocs"
745742}
746743
747- function enable_mpm_event {
748- typeset SSL_LIB=$1
749- if [[ -z " ${SSL_LIB} " ]] ; then
750- SSL_LIB=' openssl-master'
751- fi
752- typeset CONF_FILE=" ${INSTALL_ROOT} /${SSL_LIB} /conf/httpd.conf"
753-
754- #
755- # comment out currently loaded mpm module
756- #
757- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
758- sed -e ' s/\(^LoadModule mpm_.*$\)/#\1/g' \
759- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
760-
761- #
762- # enable event mpm module
763- #
764- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
765- sed -e ' s/\(^#\)\(LoadModule mpm_event_module .*$\)/\2/g' \
766- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
767- }
768-
769- function enable_mpm_worker {
770- typeset SSL_LIB=$1
771- if [[ -z " ${SSL_LIB} " ]] ; then
772- SSL_LIB=' openssl-master'
773- fi
774- typeset CONF_FILE=" ${INSTALL_ROOT} /${SSL_LIB} /conf/httpd.conf"
775-
776- #
777- # comment out currently loaded mpm module
778- #
779- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
780- sed -e ' s/\(^LoadModule mpm_.*$\)/#\1/g' \
781- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
782-
783- #
784- # enable worker mpm module
785- #
786- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
787- sed -e ' s/\(^#\)\(LoadModule mpm_worker_module .*$\)/\2/g' \
788- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
789- }
790-
791- function enable_mpm_prefork {
792- typeset SSL_LIB=$1
793- if [[ -z " ${SSL_LIB} " ]] ; then
794- SSL_LIB=' openssl-master'
795- fi
796- typeset CONF_FILE=" ${INSTALL_ROOT} /${SSL_LIB} /conf/httpd.conf"
797-
798- #
799- # comment out currently loaded mpm module
800- #
801- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
802- sed -e ' s/\(^LoadModule mpm_.*$\)/#\1/g' \
803- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
804-
805- #
806- # enable pre-fork mpm module
807- #
808- cp " ${CONF_FILE} " " ${CONF_FILE} " .wrk
809- sed -e ' s/\(^#\)\(LoadModule mpm_prefork_module .*$\)/\2/g' \
810- " ${CONF_FILE} " .wrk > " ${CONF_FILE} " || exit 1
811- }
812-
813- function run_test {
814- typeset SSL_LIB=$1
815- typeset HAPROXY=$2
816- typeset i=0
817- typeset PORT=${HTTPS_PORT}
818- typeset PROTOCOL=" https"
819- if [[ -z " ${SSL_LIB} " ]] ; then
820- SSL_LIB=' openssl-master'
821- fi
822- if [[ -z " ${HAPROXY} " ]] ; then
823- HAPROXY=' no'
824- fi
825- typeset RESULTS=" ${SSL_LIB} " .txt
826- if [[ " ${SSL_LIB} " = ' nossl' ]] ; then
827- SSL_LIB=' openssl-master'
828- RESULTS=' nossl.txt'
829- PORT=${HTTP_PORT}
830- PROTOCOL=" http"
831- fi
832- if [[ " ${HAPROXY} " != ' no' ]] ; then
833- RESULTS=" haproxy-${SSL_LIB} -${HAPROXY} .txt"
834- fi
835- typeset HTDOCS=" ${INSTALL_ROOT} /${SSL_LIB} " /htdocs
836- typeset SIEGE=" ${INSTALL_ROOT} " /openssl-master/bin/siege
837-
838- #
839- # we always try to use siege from openssl master by default,
840- # if not found then we try the one which is installed for
841- # openssl version we'd like to test.
842- #
843- if [[ ! -x " ${SIEGE} " ]] ; then
844- echo " no ${SIEGE} "
845- exit 1
846- fi
847-
848- #
849- # generate URLs for sewage
850- #
851- # The different modes for haproxy are:
852- # no: client - server
853- # no-ssl: client -http- haproxy -http- server
854- # server: client -https- haproxy -http- server
855- # client: client -http- haproxy -https- server
856- # both: client -https- haproxy -https- server
857- #
858- # Otherwise said, haproxy is a client when it encrypts the outgoing encryption;
859- # or it's client side.
860- #
861- rm -f siege_urls.txt
862- for i in ` ls -1 ${HTDOCS} /* .txt` ; do
863- if [[ " ${HAPROXY} " = " no" ]] ; then
864- echo " ${PROTOCOL} ://${HOST} :${PORT} /` basename $i ` " >> siege_urls.txt
865- elif [[ " ${HAPROXY} " = " no-ssl" ]] ; then
866- echo " http://${HOST} :${HAPROXY_NOSSL_PORT} /` basename $i ` " >> siege_urls.txt
867- elif [[ " ${HAPROXY} " = " server" ]] ; then
868- echo " https://${HOST} :${HAPROXY_C2P_PORT} /` basename $i ` " >> siege_urls.txt
869- elif [[ " ${HAPROXY} " = " client" ]] ; then
870- echo " http://${HOST} :${HAPROXY_P2S_PORT} /` basename $i ` " >> siege_urls.txt
871- elif [[ " ${HAPROXY} " = " both" ]] ; then
872- echo " https://${HOST} :${HAPROXY_C2S_PORT} /` basename $i ` " >> siege_urls.txt
873- fi
874- done
875-
876- if [[ " ${HAPROXY} " = " server" ]] || [[ " ${HAPROXY} " = " both" ]] ; then
877- conf_siege_haproxy_cert $SSL_LIB
878- fi
879-
880- #
881- # start apache httpd server
882- #
883- LD_LIBRARY_PATH=${INSTALL_ROOT} /${SSL_LIB} /lib \
884- ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd -k start || exit 1
885- if [[ $? -ne 0 ]] ; then
886- echo " could not start ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd"
887- exit 1
888- fi
889- LD_LIBRARY_PATH=${INSTALL_ROOT} /openssl-master/lib " ${SIEGE} " -t ${TEST_TIME} -b \
890- -f siege_urls.txt 2> " ${RESULT_DIR} /${RESULTS} "
891- if [[ $? -ne 0 ]] ; then
892- echo " ${INSTALL_ROOT} /${SSL_LIB} can not run siege"
893- cat " ${RESULT_DIR} /${RESULTS} "
894- exit 1
895- fi
896-
897- LD_LIBRARY_PATH=${INSTALL_ROOT} /${SSL_LIB} /lib \
898- ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd -k stop || exit 1
899- sleep 1
900- pgrep httpd
901- while [[ $? -eq 0 ]] ; do
902- sleep 1
903- LD_LIBRARY_PATH=${INSTALL_ROOT} /${SSL_LIB} /lib \
904- ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd -k stop || exit 1
905- echo " stopping ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd"
906- pgrep httpd
907- done
908-
909- #
910- # save apache configuration used for testing along the results.
911- # we do care about httpd.conf and httpd-ssl.conf only as only
912- # those two were modified.
913- #
914- cp ${INSTALL_ROOT} /${SSL_LIB} /conf/httpd.conf \
915- ${RESULT_DIR} /httpd-${SSL_LIB} .conf
916- cp ${INSTALL_ROOT} /${SSL_LIB} /conf/extra/httpd-ssl.conf \
917- ${RESULT_DIR} /httpd-ssl-${SSL_LIB} .conf
918-
919- if [[ " ${HAPROXY} " = " server" ]] || [[ " ${HAPROXY} " = " both" ]] ; then
920- unconf_siege_haproxy_cert
921- fi
922- }
923-
924744function setup_tests {
925745 typeset i=0
926746 install_openssl master
@@ -1006,127 +826,7 @@ function setup_tests {
1006826 clean_build
1007827}
1008828
1009- function run_tests {
1010- typeset SAVE_RESULT_DIR=" ${RESULT_DIR} "
1011- typeset HAPROXY_OPTIONS=(' no' ' client' ' server' ' both' )
1012- typeset i=" "
1013-
1014- for i in event worker pre-fork ; do
1015- mkdir -p ${RESULT_DIR} /$i || exit 1
1016- done
1017-
1018- enable_mpm_event
1019- RESULT_DIR=" ${SAVE_RESULT_DIR} /event"
1020- run_test nossl
1021- run_haproxy
1022- run_test nossl ' no-ssl'
1023- kill_haproxy
1024- for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
1025- enable_mpm_event openssl-${i}
1026- run_haproxy openssl-${i}
1027- for OPTION in ${HAPROXY_OPTIONS[@]}
1028- do
1029- run_test openssl-${i} ${OPTION}
1030- done
1031- kill_haproxy
1032- done
1033- enable_mpm_event openssl-master
1034- run_haproxy openssl-master
1035- for OPTION in ${HAPROXY_OPTIONS[@]}
1036- do
1037- run_test openssl-master ${OPTION}
1038- done
1039- kill_haproxy
1040- enable_mpm_event OpenSSL_1_1_1-stable
1041- run_test OpenSSL_1_1_1-stable
1042- enable_mpm_event libressl-4.1.0
1043- run_test libressl-4.1.0
1044- # enable_mpm_event wolfssl-5.8.2
1045- # run_test wolfssl-5.8.2
1046- enable_mpm_event boringssl
1047- run_test boringssl
1048- enable_mpm_event aws-lc
1049- run_test aws-lc
1050-
1051- enable_mpm_worker
1052- RESULT_DIR=" ${SAVE_RESULT_DIR} /worker"
1053- run_test nossl
1054- run_haproxy
1055- run_test nossl ' no-ssl'
1056- kill_haproxy
1057- for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
1058- enable_mpm_worker openssl-${i}
1059- run_test openssl-${i}
1060- run_haproxy openssl-${i}
1061- for OPTION in ${HAPROXY_OPTIONS[@]}
1062- do
1063- run_test openssl-${i} ${OPTION}
1064- done
1065- kill_haproxy
1066- done
1067- enable_mpm_worker openssl-master
1068- run_haproxy openssl-master
1069- for OPTION in ${HAPROXY_OPTIONS[@]}
1070- do
1071- run_test openssl-master ${OPTION}
1072- done
1073- kill_haproxy
1074- enable_mpm_worker OpenSSL_1_1_1-stable
1075- run_test OpenSSL_1_1_1-stable
1076- enable_mpm_worker libressl-4.1.0
1077- run_test libressl-4.1.0
1078- # enable_mpm_worker wolfssl-5.8.2
1079- # run_test wolfssl-5.8.2
1080- enable_mpm_worker boringssl
1081- run_test boringssl
1082- enable_mpm_worker aws-lc
1083- run_test aws-lc
1084-
1085- enable_mpm_prefork
1086- RESULT_DIR=" ${SAVE_RESULT_DIR} /pre-fork"
1087- run_test nossl
1088- run_haproxy
1089- run_test nossl ' no-ssl'
1090- kill_haproxy
1091- for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
1092- enable_mpm_prefork openssl-${i}
1093- run_test openssl-${i}
1094- run_haproxy openssl-${i}
1095- for OPTION in ${HAPROXY_OPTIONS[@]}
1096- do
1097- run_test openssl-${i} ${OPTION}
1098- done
1099- kill_haproxy
1100- done
1101- enable_mpm_prefork openssl-master
1102- run_haproxy openssl-master
1103- for OPTION in ${HAPROXY_OPTIONS[@]}
1104- do
1105- run_test openssl-master ${OPTION}
1106- done
1107- kill_haproxy
1108- enable_mpm_prefork OpenSSL_1_1_1-stable
1109- run_test OpenSSL_1_1_1-stable
1110- enable_mpm_prefork libressl-4.1.0
1111- run_test libressl-4.1.0
1112- # enable_mpm_prefork wolfssl-5.8.2
1113- # run_test wolfssl-5.8.2
1114- enable_mpm_prefork boringssl
1115- run_test boringssl
1116- enable_mpm_prefork aws-lc
1117- run_test aws-lc
1118-
1119- RESULT_DIR=${SAVE_RESULT_DIR}
1120- }
1121-
1122829check_env
1123830setup_tests
1124- run_tests
1125- SAVE_RESULT_DIR=${RESULT_DIR}
1126- for i in event worker pre-fork ; do
1127- RESULT_DIR=${SAVE_RESULT_DIR} /$i
1128- plot_results
1129- done
1130- RESULT_DIR=${SAVE_RESULT_DIR}
1131831
1132- echo " testing using siege is complete, results can be found ${RESULT_DIR} : "
832+ echo " apache was successfully configured. "
0 commit comments