#!/bin/bash . common_func.sh || error_out echo -n "Estimating fork overhead... " FORK_OVERHEAD=$(calculate_curl_fork_overhead) echo "done!" # # TEST DEFINITION # test_gal_search() { for n in $(seq $SOGO_TEST_ITERATIONS); do curl -s -o /dev/null --basic --user sogo$1:sogo \ --request REPORT \ --header "Depth:1" \ --header "Content-Type:text/xml" \ --data @- \ $SOGO_SERVER_URL/sogo$1/Contacts/$SOGO_AUTHENTICATION_SOURCE_ID < sogo EOF done; } export -f test_gal_search # # TEST EXECUTION # echo "Starting GAL search test..." START=$(date +%s%N) seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_gal_search {} END=$(date +%s%N) # # TEST RESULTS # DIFF=$(echo "scale=2; $(( $END - $START)) / 1000000000" | bc -l) TOTAL=$(( $SOGO_CONCURRENCY_LIMIT * $SOGO_TEST_ITERATIONS )) DIFF_WITHOUT_FORK=$(echo "scale=2; $DIFF - $FORK_OVERHEAD" | bc -l) THROUGHPUT=$(echo "scale=2; $TOTAL / $DIFF_WITHOUT_FORK" | bc -l) echo "completed!" echo "It took $DIFF seconds to run the test with the fork overhead of $FORK_OVERHEAD seconds." echo "The real execution time for the test is $DIFF_WITHOUT_FORK seconds." echo "Throughput achieved is $THROUGHPUT requests per second." # # TEST DEFINITION # test_contacts_search() { for n in $(seq $SOGO_TEST_ITERATIONS); do curl -s -o /dev/null --basic --user sogo$1:sogo \ --request REPORT \ --header "Depth:1" \ --header "Content-Type:text/xml" \ --data @- \ $SOGO_SERVER_URL/sogo$1/Contacts/personal/ < john$n EOF done; } export -f test_contacts_search # # TEST EXECUTION # echo "Starting contacts search test..." START=$(date +%s%N) seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_contacts_search {} END=$(date +%s%N) # # TEST RESULTS # DIFF=$(echo "scale=2; $(( $END - $START)) / 1000000000" | bc -l) TOTAL=$(( $SOGO_CONCURRENCY_LIMIT * $SOGO_TEST_ITERATIONS )) DIFF_WITHOUT_FORK=$(echo "scale=2; $DIFF - $FORK_OVERHEAD" | bc -l) THROUGHPUT=$(echo "scale=2; $TOTAL / $DIFF_WITHOUT_FORK" | bc -l) echo "completed!" echo "It took $DIFF seconds to run the test with the fork overhead of $FORK_OVERHEAD seconds." echo "The real execution time for the test is $DIFF_WITHOUT_FORK seconds." echo "Throughput achieved is $THROUGHPUT requests per second." # # TEST DEFINITION # test_calendar_search() { for n in $(seq $SOGO_TEST_ITERATIONS); do curl -s -o /dev/null --basic --user sogo$1:sogo \ --request REPORT \ --header "Depth:1" \ --header "Content-Type:text/xml" \ --data @- \ $SOGO_SERVER_URL/sogo$1/Calendar/personal/ < EOF done; } export -f test_calendar_search # # TEST EXECUTION # echo "Starting calendar search test..." START=$(date +%s%N) seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_calendar_search {} END=$(date +%s%N) # # TEST RESULTS # DIFF=$(echo "scale=2; $(( $END - $START)) / 1000000000" | bc -l) TOTAL=$(( $SOGO_CONCURRENCY_LIMIT * $SOGO_TEST_ITERATIONS )) DIFF_WITHOUT_FORK=$(echo "scale=2; $DIFF - $FORK_OVERHEAD" | bc -l) THROUGHPUT=$(echo "scale=2; $TOTAL / $DIFF_WITHOUT_FORK" | bc -l) echo "completed!" echo "It took $DIFF seconds to run the test with the fork overhead of $FORK_OVERHEAD seconds." echo "The real execution time for the test is $DIFF_WITHOUT_FORK seconds." echo "Throughput achieved is $THROUGHPUT requests per second."