/
inspire-qos-check
executable file
·204 lines (170 loc) · 7.83 KB
/
inspire-qos-check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
# TODO:
# * verbosity adjustement with -v -vv -vvv
# Example required environment variables:
# BASEURL="https://lb.lb-http.geograndest.caas.camptocamp.com"
# WMS_SERVICE_PATH="geoserver/wms"
# WFS_SERVICE_PATH="geoserver/wfs"
# WCS_SERVICE_PATH="geoserver/wcs"
# NUMBER_OF_SAMPLES=100
# VECTORLAYER="geor:public_layer"
# FEATURE_COUNT=33
# WMS_CRS="EPSG:3857"
# WMS_BBOX="-20820223,-20820223,20820223,20820223"
# WCS_COVERAGEID="cigal__CIGAL_ORTHORVB_2007_ALSACE_TIFA_CC48"
# WCS_SUBSET1="E(2035000,2036000)"
# WCS_SUBSET2="N(7240000,7241000)"
trap 'exit 0' SIGKILL SIGTERM SIGHUP SIGINT EXIT
checkTTFB() {
local url=$1
local concurrency=$2
local maximum_time_ms=$3
local ms=`ab -n $NUMBER_OF_SAMPLES -c $concurrency "$url" | grep Processing | rev | cut -f 1 -d ' ' | rev`
# local s=`echo "scale=3;$ms/1000" | bc`
generateReport $ms "gt" $maximum_time_ms "msec"
}
checkTransferRate() {
local url=$1
local concurrency=$2
local minimum_transfer_rate_kb=$3
local kbs=`ab -n $NUMBER_OF_SAMPLES -c $concurrency "$url" | grep Transfer | rev | cut -d ' ' -f 3 | rev` # [Kbytes/sec] received
# dividing by concurrency level to get an idea of how fast one client gets his file:
local kbsint=`echo "$kbs/$concurrency" | bc`
generateReport $kbsint "lt" $minimum_transfer_rate_kb "Kbytes/sec"
}
checkFeatureTransferRate() {
local url=$1
local concurrency=$2
local minimum_feature_transfer_rate=$3 # eg 500 features/sec
local number_of_features_returned_by_query=$4
local maxms=`ab -n $NUMBER_OF_SAMPLES -c $concurrency "$url" | grep Processing | rev | cut -d ' ' -f 1 | rev` # Processing ms
local fps=`echo "1000*$number_of_features_returned_by_query/$maxms" | bc`
generateReport $fps "lt" $minimum_feature_transfer_rate "features/sec"
}
checkThroughput() {
local url=$1
local concurrency=$2
local rps=`ab -n $NUMBER_OF_SAMPLES -c $concurrency "$url" | grep Requests | rev | cut -d ' ' -f 3 | rev`
local rpsint=`echo $rps | cut -f 1 -d '.'`
generateReport $rpsint "lt" $concurrency "requests served per second"
}
echoNOK() {
echo -ne "\033[01;31m$1\033[00m"
}
echoOK() {
echo -ne "\033[1;36m$1\033[00m"
}
generateReport() {
if [ $1 -$2 $3 ]
then
echoNOK "[NOK]"
else
echoOK "[OK]"
fi
echo " ($1 $4)"
}
checkExpectedType() {
local url=$1
echo "Checking $url"
local expectedContentType=$2
local httpcode=`curl --write-out "%{http_code}\n" --silent --output /dev/null "$url"`
if [ "$httpcode" != "200" ]; then
echo ""
echoNOK "Oops, the request does not seem correct (HTTP $httpcode). Please double check above URL."
echo ""
exit 1
fi
local type=`curl --write-out "%{content_type}\n" --silent --output /dev/null "$url"`
if [ "${type,,}" != "$expectedContentType" ]; then
echo ""
echoNOK "Oops, the request does not seem correct (Content-Type $type does not match expected $expectedContentType). Please double check above URL."
echo ""
exit 1
fi
}
echo ""
echo "Testing VIEW service"
echo "===================="
echo ""
echo "[PERF] Maximum 10 seconds to get the first bytes of the WMS service metadata with 20 concurrent requests"
url="$BASEURL/$WMS_SERVICE_PATH?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities"
checkExpectedType $url "text/xml;charset=utf-8"
checkTTFB $url 20 10000
echo ""
echo "[PERF] Maximum 5 seconds to get the first bytes of a 800x600 8 bit bitmap WMS GetMap with 20 concurrent requests"
url="$BASEURL/$WMS_SERVICE_PATH?SERVICE=WMS&LAYERS=$VECTORLAYER&FORMAT=image/tiff8&VERSION=1.3.0&SLD_VERSION=1.1.0&REQUEST=GetMap&CRS=$WMS_CRS&BBOX=$WMS_BBOX&WIDTH=800&HEIGHT=600"
checkExpectedType $url "image/tiff8"
checkTTFB $url 20 5000
echo ""
echo "[CAPACITY] Minimum 20 simultaneous service requests served per second"
url="$BASEURL/$WMS_SERVICE_PATH?SERVICE=WMS&LAYERS=$VECTORLAYER&FORMAT=image/tiff8&VERSION=1.3.0&SLD_VERSION=1.1.0&REQUEST=GetMap&CRS=$WMS_CRS&BBOX=$WMS_BBOX&WIDTH=800&HEIGHT=600"
checkExpectedType $url "image/tiff8"
checkThroughput $url 20
echo ""
echo ""
echo "Testing VECTOR DOWNLOAD service"
echo "==============================="
echo ""
echo "[PERF] Maximum 10 seconds to get the first bytes of the WFS service metadata with 10 concurrent requests"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities"
checkExpectedType $url "application/xml;charset=utf-8"
checkTTFB $url 10 10000
echo ""
echo "[PERF] Maximum 30 seconds to get the first bytes of a full dataseries with 10 concurrent requests"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&REQUEST=GetFeature&TYPENAME=$VECTORLAYER&OUTPUTFORMAT=shape-zip"
checkExpectedType $url "application/zip"
checkTTFB $url 10 30000
echo ""
echo "[CAPACITY] Minimum 500 features/seconds to get a full dataseries with 10 concurrent requests"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=$VECTORLAYER&OUTPUTFORMAT=shape-zip"
checkExpectedType $url "application/zip"
checkFeatureTransferRate $url 10 500 $FEATURE_COUNT
echo ""
echo "[PERF] Maximum 30 seconds to get the first bytes of a single feature with 10 concurrent requests"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=$VECTORLAYER&count=1"
checkExpectedType $url "application/gml+xml; version=3.2"
checkTTFB $url 10 30000
echo ""
echo "[PERF] Maximum 10 seconds to get the first bytes of a describe featuretype query with 10 concurrent requests"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&VERSION=2.0.0&REQUEST=DescribeFeatureType&TYPENAME=$VECTORLAYER"
checkExpectedType $url "application/gml+xml; version=3.2"
checkTTFB $url 10 10000
echo ""
echo "[CAPACITY] Minimum 10 simultaneous service requests served per second"
url="$BASEURL/$WFS_SERVICE_PATH?SERVICE=WFS&REQUEST=GetFeature&TYPENAME=$VECTORLAYER&OUTPUTFORMAT=shape-zip"
checkExpectedType $url "application/zip"
checkThroughput $url 10
echo ""
echo ""
echo "Testing RASTER DOWNLOAD service"
echo "==============================="
echo ""
echo "[PERF] Maximum 10 seconds to get the first bytes of the WCS service metadata with 10 concurrent requests"
url="$BASEURL/$WCS_SERVICE_PATH?SERVICE=WCS&VERSION=2.0.1&REQUEST=GetCapabilities"
checkExpectedType $url "application/xml;charset=utf-8"
checkTTFB $url 10 10000
echo ""
#~ For the Get Spatial Data Set operation and for the Get Spatial Object operation, and for a
#~ query consisting exclusively of a bounding box, the response time for sending the initial response shall
#~ be maximum 30 seconds in normal situation
echo "[PERF] Maximum 30 seconds to get the first bytes of a bbox query with 10 concurrent requests"
url="$BASEURL/$WCS_SERVICE_PATH?SERVICE=WCS&VERSION=2.0.1&REQUEST=GetCoverage&COVERAGEID=$WCS_COVERAGEID&FORMAT=image/tiff&SUBSET=$WCS_SUBSET1&SUBSET=$WCS_SUBSET2"
checkExpectedType $url "image/tiff"
checkTTFB $url 10 30000
echo ""
#~ then, and still in normal situation, the download service
#~ shall maintain a sustained response greater than 0,5 Megabytes per second or greater than 500
#~ Spatial Objects per second.
echo "[CAPACITY] Minimum 512kb/s transfer rate to get a bbox query with 10 concurrent requests"
url="$BASEURL/$WCS_SERVICE_PATH?SERVICE=WCS&VERSION=2.0.1&REQUEST=GetCoverage&COVERAGEID=$WCS_COVERAGEID&FORMAT=image/tiff&SUBSET=$WCS_SUBSET1&SUBSET=$WCS_SUBSET2"
checkExpectedType $url "image/tiff"
checkTransferRate $url 10 512
echo ""
#~ For the Describe Spatial Data Set operation and for the Describe Spatial Object Type
#~ operation, the response time for sending the initial response shall be maximum 10 seconds in normal
#~ situation
echo "[PERF] Maximum 10 seconds to get the first bytes of a describe coverage query with 10 concurrent requests"
url="$BASEURL/$WCS_SERVICE_PATH?SERVICE=WCS&VERSION=2.0.1&REQUEST=DescribeCoverage&COVERAGEID=$WCS_COVERAGEID"
checkExpectedType $url "application/xml;charset=utf-8"
checkTTFB $url 10 10000
echo ""