Time per request: 62.748 [ms] (mean)
Requests per second: 74.76 [#/sec] (mean)
Time per request: 93.782 [ms] (mean)
Requests per second: 48.26 [#/sec] (mean)
Fernet token creation response time is 13% faster than UUID.
Fernet token validation response time is 400% slower than UUID.
(default devstack configuration)
Fernet token creation requests per second is 30% faster than UUID.
Fernet token validation requests per second is 81% slower than UUID.
{"auth": {"scope": {"project": {"name": "admin", "domain": {"id": "default"}}}, "identity": {"methods": ["password"], "password": {"user": {"domain": {"id": "default"}, "name": "admin", "password": "nomoresecrete"}}}}} |
{"auth": {"scope": {"project": {"name": "demo", "domain": {"id": "default"}}}, "identity": {"methods": ["password"], "password": {"user": {"domain": {"id": "default"}, "name": "demo", "password": "nomoresecrete"}}}}} |
#!/bin/bash | |
set -e | |
HOST=${HOST:-127.0.0.1} | |
SECONDS_PER_BENCHMARK=${T:-60} | |
CONCURRENCY=${C:-20} | |
function authenticate() { | |
BODY=`cat $1` | |
X_SUBJECT_TOKEN=`http --verbose post $ENDPOINT/v3/auth/tokens "$BODY" --content-type="application/json" | grep "X-Subject-Token: "` | |
TOKEN=${X_SUBJECT_TOKEN##*:} | |
} | |
ENDPOINT="http://$HOST:35357" | |
# generate an admin token for later | |
authenticate auth_request_admin.json | |
ADMIN_TOKEN=$TOKEN | |
echo "Admin token: $ADMIN_TOKEN" | |
authenticate auth_request_demo.json | |
DEMO_TOKEN=$TOKEN | |
echo "Demo token: $DEMO_TOKEN" | |
# I'm sure you can do this in bash, but this seemed easier. | |
TOKEN_FORMAT=`python -c "print('UUID' if len('$ADMIN_TOKEN'.strip()) == 32 else 'Fernet')"` | |
# reset results file | |
: > _${TOKEN_FORMAT}_results.md | |
echo "Benchmarking token creation (1/2)..." | |
echo "## $TOKEN_FORMAT token creation" >> _${TOKEN_FORMAT}_results.md | |
echo >> _${TOKEN_FORMAT}_results.md | |
ab -t $SECONDS_PER_BENCHMARK -c 1 -p auth_request_demo.json -T "application/json" $ENDPOINT/v3/auth/tokens | grep "(mean)" | grep "Time per request" >> _${TOKEN_FORMAT}_results.md | |
echo "Benchmarking token creation (2/2)..." | |
echo >> _${TOKEN_FORMAT}_results.md | |
ab -t $SECONDS_PER_BENCHMARK -c $CONCURRENCY -p auth_request_demo.json -T "application/json" $ENDPOINT/v3/auth/tokens | grep "Requests per second:" >> _${TOKEN_FORMAT}_results.md | |
echo "Benchmarking token validation (1/2)..." | |
echo >> _${TOKEN_FORMAT}_results.md | |
echo "## $TOKEN_FORMAT token validation" >> _${TOKEN_FORMAT}_results.md | |
echo >> _${TOKEN_FORMAT}_results.md | |
ab -t $SECONDS_PER_BENCHMARK -c 1 -T "application/json" -H "X-Auth-Token: $ADMIN_TOKEN" -H "X-Subject-Token: $TOKEN" $ENDPOINT/v3/auth/tokens | grep "(mean)" | grep "Time per request" >> _${TOKEN_FORMAT}_results.md | |
echo "Benchmarking token validation (2/2)..." | |
echo >> _${TOKEN_FORMAT}_results.md | |
ab -t $SECONDS_PER_BENCHMARK -c $CONCURRENCY -T "application/json" -H "X-Auth-Token: $ADMIN_TOKEN" -H "X-Subject-Token: $TOKEN" $ENDPOINT/v3/auth/tokens | grep "Requests per second:" >> _${TOKEN_FORMAT}_results.md | |
# let's see the results! | |
cat _${TOKEN_FORMAT}_results.md |
httpcli |
ab - Apache HTTP server benchmarking tool