@@ -63,8 +63,10 @@ CERT_ALT_SUBJ=${BENCH_CERT_ALT_SUBJ:-'subjectAltName=DNS:localhost,IP:127.0.0.1'
6363TEST_TIME=${BENCH_TEST_TIME:- ' 5M' }
6464HOST=${BENCH_HOST:- ' 127.0.0.1' }
6565APACHE_VERSION=' 2.4.65'
66+ HAPROXY=' no'
6667
6768. ./common_util.sh
69+ . ./haproxy_bench.sh
6870
6971function install_wolfssl_for_apache {
7072 typeset VERSION=$1
@@ -810,18 +812,25 @@ function enable_mpm_prefork {
810812
811813function run_test {
812814 typeset SSL_LIB=$1
813- typeset HTTP= ' https '
815+ typeset HAPROXY= $2
814816 typeset i=0
815817 typeset PORT=${HTTPS_PORT}
818+ typeset PROTOCOL=" https"
816819 if [[ -z " ${SSL_LIB} " ]] ; then
817820 SSL_LIB=' openssl-master'
818821 fi
822+ if [[ -z " ${HAPROXY} " ]] ; then
823+ HAPROXY=' no'
824+ fi
819825 typeset RESULTS=" ${SSL_LIB} " .txt
820826 if [[ " ${SSL_LIB} " = ' nossl' ]] ; then
821- HTTP=' http'
822827 SSL_LIB=' openssl-master'
823828 RESULTS=' nossl.txt'
824829 PORT=${HTTP_PORT}
830+ PROTOCOL=" http"
831+ fi
832+ if [[ " ${HAPROXY} " != ' no' ]] ; then
833+ RESULTS=" haproxy-${SSL_LIB} -${HAPROXY} .txt"
825834 fi
826835 typeset HTDOCS=" ${INSTALL_ROOT} /${SSL_LIB} " /htdocs
827836 typeset SIEGE=" ${INSTALL_ROOT} " /openssl-master/bin/siege
@@ -839,11 +848,35 @@ function run_test {
839848 #
840849 # generate URLs for sewage
841850 #
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+ #
842861 rm -f siege_urls.txt
843862 for i in ` ls -1 ${HTDOCS} /* .txt` ; do
844- echo " ${HTTP} ://${HOST} :${PORT} /` basename $i ` " >> siege_urls.txt
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
845874 done
846875
876+ if [[ " ${HAPROXY} " = " server" ]] || [[ " ${HAPROXY} " = " both" ]] ; then
877+ conf_siege_haproxy_cert $SSL_LIB
878+ fi
879+
847880 #
848881 # start apache httpd server
849882 #
@@ -856,13 +889,14 @@ function run_test {
856889 LD_LIBRARY_PATH=${INSTALL_ROOT} /openssl-master/lib " ${SIEGE} " -t ${TEST_TIME} -b \
857890 -f siege_urls.txt 2> " ${RESULT_DIR} /${RESULTS} "
858891 if [[ $? -ne 0 ]] ; then
859- echo " ${INSTALL_ROOT} /${SSL_LIB} can not run siege"
892+ echo " ${INSTALL_ROOT} /${SSL_LIB} can not run siege"
860893 cat " ${RESULT_DIR} /${RESULTS} "
861894 exit 1
862895 fi
863896
864897 LD_LIBRARY_PATH=${INSTALL_ROOT} /${SSL_LIB} /lib \
865898 ${INSTALL_ROOT} /${SSL_LIB} /bin/httpd -k stop || exit 1
899+ sleep 1
866900 pgrep httpd
867901 while [[ $? -eq 0 ]] ; do
868902 sleep 1
@@ -881,20 +915,26 @@ function run_test {
881915 ${RESULT_DIR} /httpd-${SSL_LIB} .conf
882916 cp ${INSTALL_ROOT} /${SSL_LIB} /conf/extra/httpd-ssl.conf \
883917 ${RESULT_DIR} /httpd-ssl-${SSL_LIB} .conf
918+
919+ if [[ " ${HAPROXY} " = " server" ]] || [[ " ${HAPROXY} " = " both" ]] ; then
920+ unconf_siege_haproxy_cert
921+ fi
884922}
885923
886924function setup_tests {
887925 install_openssl master
888926 install_siege openssl-master
889927 install_apache openssl-master
890928 config_apache openssl-master
929+ install_haproxy openssl-master
891930 cd " ${WORKSPACE_ROOT} "
892931 clean_build
893932
894933 for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
895934 install_openssl openssl-$i ;
896935 install_apache openssl-$i
897936 config_apache openssl-$i
937+ install_haproxy openssl-$i
898938 cd " ${WORKSPACE_ROOT} "
899939 clean_build
900940 done
@@ -967,6 +1007,7 @@ function setup_tests {
9671007
9681008function run_tests {
9691009 typeset SAVE_RESULT_DIR=" ${RESULT_DIR} "
1010+ typeset HAPROXY_OPTIONS=(' no' ' client' ' server' ' both' )
9701011
9711012 for i in event worker pre-fork ; do
9721013 mkdir -p ${RESULT_DIR} /$i || exit 1
@@ -975,12 +1016,25 @@ function run_tests {
9751016 enable_mpm_event
9761017 RESULT_DIR=" ${SAVE_RESULT_DIR} /event"
9771018 run_test nossl
1019+ run_haproxy
1020+ run_test nossl ' no-ssl'
1021+ kill_haproxy
9781022 for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
9791023 enable_mpm_event openssl-${i}
980- run_test openssl-${i}
1024+ run_haproxy openssl-${i}
1025+ for OPTION in ${HAPROXY_OPTIONS[@]}
1026+ do
1027+ run_test openssl-${i} ${OPTION}
1028+ done
1029+ kill_haproxy
9811030 done
9821031 enable_mpm_event openssl-master
983- run_test openssl-master
1032+ run_haproxy openssl-master
1033+ for OPTION in ${HAPROXY_OPTIONS[@]}
1034+ do
1035+ run_test openssl-master ${OPTION}
1036+ done
1037+ kill_haproxy
9841038 enable_mpm_event OpenSSL_1_1_1-stable
9851039 run_test OpenSSL_1_1_1-stable
9861040 enable_mpm_event libressl-4.1.0
@@ -995,12 +1049,26 @@ function run_tests {
9951049 enable_mpm_worker
9961050 RESULT_DIR=" ${SAVE_RESULT_DIR} /worker"
9971051 run_test nossl
1052+ run_haproxy
1053+ run_test nossl ' no-ssl'
1054+ kill_haproxy
9981055 for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
9991056 enable_mpm_worker openssl-${i}
10001057 run_test openssl-${i}
1058+ run_haproxy openssl-${i}
1059+ for OPTION in ${HAPROXY_OPTIONS[@]}
1060+ do
1061+ run_test openssl-${i} ${OPTION}
1062+ done
1063+ kill_haproxy
10011064 done
10021065 enable_mpm_worker openssl-master
1003- run_test openssl-master
1066+ run_haproxy openssl-master
1067+ for OPTION in ${HAPROXY_OPTIONS[@]}
1068+ do
1069+ run_test openssl-master ${OPTION}
1070+ done
1071+ kill_haproxy
10041072 enable_mpm_worker OpenSSL_1_1_1-stable
10051073 run_test OpenSSL_1_1_1-stable
10061074 enable_mpm_worker libressl-4.1.0
@@ -1015,12 +1083,26 @@ function run_tests {
10151083 enable_mpm_prefork
10161084 RESULT_DIR=" ${SAVE_RESULT_DIR} /pre-fork"
10171085 run_test nossl
1086+ run_haproxy
1087+ run_test nossl ' no-ssl'
1088+ kill_haproxy
10181089 for i in 3.0 3.1 3.2 3.3 3.4 3.5 3.6 ; do
10191090 enable_mpm_prefork openssl-${i}
10201091 run_test openssl-${i}
1092+ run_haproxy openssl-${i}
1093+ for OPTION in ${HAPROXY_OPTIONS[@]}
1094+ do
1095+ run_test openssl-${i} ${OPTION}
1096+ done
1097+ kill_haproxy
10211098 done
10221099 enable_mpm_prefork openssl-master
1023- run_test openssl-master
1100+ run_haproxy openssl-master
1101+ for OPTION in ${HAPROXY_OPTIONS[@]}
1102+ do
1103+ run_test openssl-master ${OPTION}
1104+ done
1105+ kill_haproxy
10241106 enable_mpm_prefork OpenSSL_1_1_1-stable
10251107 run_test OpenSSL_1_1_1-stable
10261108 enable_mpm_prefork libressl-4.1.0
0 commit comments