(feat) initial pass at generalized stress tests

pull/237/head
Ludovic Marcotte 2017-06-14 14:41:01 -04:00
parent 7464c2e680
commit 248cea87e8
9 changed files with 547 additions and 0 deletions

View File

@ -0,0 +1,41 @@
# SOGo Stress Tests
### Requirements
apt-get install parallel curl
### Stragegy
- set the concurrency level to the number of sogod workers you have
- use as many test users that you have sogod workers. For example, if
you have 10 sogod works, have 10 test users
- test users MUST be named 'sogoX' and MUST have a password set to 'sogo'. If you
have 3 test users, you should have sogo1, sogo2 and sogo3 as test
users. Make sure you delete those users when you are done with
stress-testing. Make also sure you delete the associated mailboxes
as emails sent during tests will NOT be deleted
- ensure memcached is running - you can also test without memcache and
see the performance impacts on SOGo.
### Running tests
- define your mail domain
export SOGO_MAIL_DOMAIN="example.com"
- define your SOGo server URL. Do NOT put a trailing slash
export SOGO_SERVER_URL="http://localhost/SOGo/dav"
- define the identifier of your main authentication source where your
SOGo test users are adefined
export SOGO_AUTHENTICATION_SOURCE_ID="example.com_public"
- define your concurrency limit - a minimum of 3 is required:
export SOGO_CONCURRENCY_LIMIT=3
- define the number of test iterations
export SOGO_TEST_ITERATIONS=100

View File

@ -0,0 +1,51 @@
#!/bin/bash
. common_func.sh || error_out
echo -n "Estimating fork overhead... "
FORK_OVERHEAD=$(calculate_curl_fork_overhead)
echo "done!"
#
# TEST DEFINITION
#
test_acl() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
curl -s -o /dev/null --basic --user sogo1:sogo \
--request PROPFIND \
--header "Depth: 0" \
--header "Content-Type:text/xml" \
--data @- \
$SOGO_SERVER_URL/sogo1/Calendar/personal <<EOF
<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D='DAV:'>
<D:prop>
<D:principal-collection-set/>
<D:owner/>
<D:current-user-privilege-set/>
</D:prop>
</D:propfind>
EOF
done;
}
export -f test_acl
#
# TEST EXECUTION
#
echo "Starting ACL test..."
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_acl {}
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."

View File

@ -0,0 +1,54 @@
#!/bin/bash
. common_func.sh || error_out
echo -n "Estimating fork overhead... "
FORK_OVERHEAD=$(calculate_curl_fork_overhead)
echo "done!"
#
# TEST DEFINITION
#
test_authentication() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
curl -s -o /dev/null --basic --user sogo$1:sogo \
--request PROPFIND \
--header "Depth:1" \
--header "Content-Type:text/xml" \
--data @- \
$SOGO_SERVER_URL/sogo$1 <<EOF
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:">
<prop>
<getcontentlength xmlns="DAV:"/>
<getlastmodified xmlns="DAV:"/>
<executable xmlns="http://apache.org/dav/props/"/>
<resourcetype xmlns="DAV:"/>
<checked-in xmlns="DAV:"/>
<checked-out xmlns="DAV:"/>
</prop>
</propfind>
EOF
done;
}
export -f test_authentication
#
# TEST EXECUTION
#
echo -n "Starting authentication test... "
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_authentication {}
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."

View File

@ -0,0 +1,40 @@
#!/bin/bash
echo $SOGO_CONCURRENCY_LIMIT
echo $SOGO_TEST_ITERATIONS
echo $SOGO_SERVER_URL
test_changes() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
ctag=$(date +%s)
curl -s -o /dev/null --basic --user sogo1:sogo \
--request REPORT \
--header "Depth:1" \
--header "Content-Type:text/xml" \
--data @- \
$SOGO_SERVER_URL/sogo1/Calendar/personal <<EOF
<?xml version="1.0" encoding="utf-8" ?>
<D:sync-collection xmlns:D="DAV:">
<D:sync-token>$ctag</D:sync-token>
<D:limit><D:nresults>10</D:nresults></D:limit>
<D:sync-level>1</D:sync-level>
<D:prop>
<D:getcontenttype />
<D:getetag />
</D:prop>
</D:sync-collection>
EOF
done;
}
export -f test_changes
echo "Starting changes test..."
START=$(date +%s)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_changes {}
END=$(date +%s)
DIFF=$(( $END - $START ))
echo "Completed!"
echo "It took $DIFF seconds"

View File

@ -0,0 +1,8 @@
calculate_curl_fork_overhead() {
local c_start=$(date +%s%N);
for n in $(seq $(( $SOGO_CONCURRENCY_LIMIT * $SOGO_TEST_ITERATIONS )) ); do
curl -s 2>&1 /dev/null
done;
local c_end=$(date +%s%N);
echo "scale=2; $(( $c_end - $c_start )) / 1000000000" | bc -l
}

View File

@ -0,0 +1,88 @@
#!/bin/bash
. common_func.sh || error_out
echo -n "Estimating fork overhead... "
FORK_OVERHEAD=$(calculate_curl_fork_overhead)
echo "done!"
#
# TEST DEFINITION
#
test_events_insert() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
start_date=$(/bin/date -d "today +$(($n-1)) hour" "+%Y%m%dT%H%M%S")
end_date=$(/bin/date -d "today +$n hour" "+%Y%m%dT%H%M%S")
calendar_data=$(cat <<EOF
BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Inverse//Event Generator//EN\nCALSCALE:GREGORIAN\nBEGIN:VTIMEZONE\nTZID:America/Montreal\nBEGIN:DAYLIGHT\nTZOFFSETFROM:-0500\nTZOFFSETTO:-0400\nDTSTART:20070311T020000\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\nTZNAME:EDT\nEND:DAYLIGHT\nBEGIN:STANDARD\nTZOFFSETFROM:-0400\nTZOFFSETTO:-0500\DTSTART:20071104T020000\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\nTZNAME:EST\nEND:STANDARD\nEND:VTIMEZONE\nBEGIN:VEVENT\nSEQUENCE:1\nTRANSP:OPAQUE\nUID:$n\nSUMMARY:Event $n\nDTSTART;TZID=America/Montreal:$start_date\nDTEND;TZID=America/Montreal:$end_date\nCREATED:20170605T144440Z\nDTSTAMP:20170605T144440Z\nEND:VEVENT\nEND:VCALENDAR
EOF
)
echo -e $calendar_data | curl -s -o /dev/null --basic --user sogo$1:sogo \
--request PUT \
--header "Content-Type: text/calendar" \
--data-binary @- \
$SOGO_SERVER_URL/sogo$1/Calendar/personal/$n.ics
done;
}
export -f test_events_insert
#
# TEST EXECUTION
#
echo "Starting events insert test..."
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_events_insert {}
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_insert() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
card_data=$(cat <<EOF
BEGIN:VCARD\nUID:$n\nVERSION:3.0\nCLASS:PUBLIC\nPROFILE:VCARD\nN:Doe;John\nFN:John $n Doe\nEMAIL:johndoe$n@example.com\nEND:VCARD
EOF
)
echo -e $card_data | curl -s -o /dev/null --basic --user sogo$1:sogo \
--request PUT \
--header "Content-Type: text/calendar" \
--data-binary @- \
$SOGO_SERVER_URL/sogo$1/Contacts/personal/$n.ics
done;
}
export -f test_contacts_insert
#
# TEST EXECUTION
#
echo "Starting contacts insert test..."
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_contacts_insert {}
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."

View File

@ -0,0 +1,52 @@
#!/bin/bash
. common_func.sh || error_out
echo -n "Estimating fork overhead... "
FORK_OVERHEAD=$(calculate_curl_fork_overhead)
echo "done!"
#
# TEST DEFINITION
#
test_invitation() {
for n in $(seq $SOGO_TEST_ITERATIONS); do
start_date=$(/bin/date -d "today +$(($n-1)) hour" "+%Y%m%dT%H%M%S")
end_date=$(/bin/date -d "today +$n hour" "+%Y%m%dT%H%M%S")=
results=($(shuf -i 1-$SOGO_CONCURRENCY_LIMIT -n 3 | grep -v "^$1\$"))
attendee1=${results[0]}
attendee2=${results[1]}
calendar_data=$(cat <<EOF
BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Inverse//Event Generator//EN\nCALSCALE:GREGORIAN\nBEGIN:VTIMEZONE\nTZID:America/Montreal\nBEGIN:DAYLIGHT\nTZOFFSETFROM:-0500\nTZOFFSETTO:-0400\nDTSTART:20070311T020000\nRRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\nTZNAME:EDT\nEND:DAYLIGHT\nBEGIN:STANDARD\nTZOFFSETFROM:-0400\nTZOFFSETTO:-0500\DTSTART:20071104T020000\nRRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\nTZNAME:EST\nEND:STANDARD\nEND:VTIMEZONE\nBEGIN:VEVENT\nSEQUENCE:1\nTRANSP:OPAQUE\nUID:sogo$1-$n\nSUMMARY:Event #$n-$1 invites $attendee1 and $attendee2\nDTSTART;TZID=America/Montreal:$start_date\nDTEND;TZID=America/Montreal:$end_date\nCREATED:20170605T144440Z\nDTSTAMP:20170605T144440Z\nORGANIZER:mailto:sogo$1@$SOGO_MAIL_DOMAIN\nATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;ROLE=REQ-PARTICIPANT:mailto:sogo$attendee1@$SOGO_MAIL_DOMAIN\nATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;ROLE=REQ-PARTICIPANT:mailto:sogo$attendee2@$SOGO_MAIL_DOMAIN\nEND:VEVENT\nEND:VCALENDAR
EOF
)
echo -e $calendar_data | curl -s -o /dev/null --basic --user sogo$1:sogo \
--request PUT \
--header "Content-Type: text/calendar" \
--data-binary @- \
$SOGO_SERVER_URL/sogo$1/Calendar/personal/sogo$1-$n.ics
done;
}
export -f test_invitation
#
# TEST EXECUTION
#
echo "Starting invitation test..."
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_invitation {}
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."

View File

@ -0,0 +1,156 @@
#!/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 <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<C:addressbook-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
</D:prop>
<C:filter>
<C:prop-filter name="mail">
<C:text-match collation="i;unicasemap" match-type="starts-with">sogo</C:text-match>
</C:prop-filter>
</C:filter>
</C:addressbook-query>
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/ <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<C:addressbook-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
</D:prop>
<C:filter>
<C:prop-filter name="mail">
<C:text-match collation="i;unicasemap" match-type="starts-with">john$n</C:text-match>
</C:prop-filter>
</C:filter>
</C:addressbook-query>
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
<?xml version="1.0" encoding="UTF-8"?>
<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
<d:prop>
<d:getetag />
</d:prop>
<c:filter>
<c:comp-filter name="VCALENDAR">
<c:comp-filter name="VEVENT">
<c:time-range start="20000101T000000Z"
end="20200101T000000Z"/>
</c:comp-filter>
</c:comp-filter>
</c:filter>
</c:calendar-query>
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."

View File

@ -0,0 +1,57 @@
#!/bin/bash
. common_func.sh || error_out
echo -n "Estimating fork overhead... "
FORK_OVERHEAD=$(calculate_curl_fork_overhead)
echo "done!"
#
# TEST DEFINITION
#
test_teardown() {
# Cleanup calendar test data
for n in $(seq $SOGO_TEST_ITERATIONS); do
curl -s -o /dev/null --basic --user sogo$1:sogo \
--request DELETE \
--header "Content-Type: text/xml" \
$SOGO_SERVER_URL/sogo$1/Calendar/personal/$n.ics
done;
for n in $(seq $SOGO_TEST_ITERATIONS); do
curl -s -o /dev/null --basic --user sogo$1:sogo \
--request DELETE \
--header "Content-Type: text/xml" \
$SOGO_SERVER_URL/sogo$1/Calendar/personal/sogo$1-$n.ics
done;
# Cleanup address book test data
for n in $(seq $SOGO_TEST_ITERATIONS); do
curl -s -o /dev/null --basic --user sogo$1:sogo \
--request DELETE \
--header "Content-Type: text/xml" \
$SOGO_SERVER_URL/sogo$1/Contacts/personal/$n.ics
done;
}
export -f test_teardown
#
# TEST EXECUTION
#
echo "Starting teardown test..."
START=$(date +%s%N)
seq $SOGO_CONCURRENCY_LIMIT | parallel -j0 test_teardown {}
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."