I have a Flarum instance running on my Digital Ocean VPS in a Docker container. It's a private forum which is not supposed to be used by many users, but it still has index page (with no discussions show) visible to the Internet. Hence, it maybe a target for DDoS attack.
So I decided to make a performance test before someone else did, and I got quite sad results:
$ ab -n 100 -c 10 http://<HOST>/
...
Document Path: /
Document Length: 7531 bytes
Concurrency Level: 10
Time taken for tests: 20.607 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 788700 bytes
HTML transferred: 753100 bytes
Requests per second: 4.85 [#/sec] (mean)
Time per request: 2060.714 [ms] (mean)
Time per request: 206.071 [ms] (mean, across all concurrent requests)
Transfer rate: 37.38 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 47 82 44.0 52 166
Processing: 1023 1925 248.9 1953 2932
Waiting: 1021 1906 234.8 1944 2930
Total: 1072 2007 266.6 2009 3080
Percentage of the requests served within a certain time (ms)
50% 2009
66% 2055
75% 2090
80% 2128
90% 2215
95% 2380
98% 2617
99% 3080
100% 3080 (longest request)
Why would a page which shows barely nothing require two seconds too be generated?
On the contrast, when I do this test against a static file, it operates much faster:
$ ab -n 100 -c 10 http://<HOST>/assets/rev-manifest.json
...
Document Path: /assets/rev-manifest.json
Document Length: 191 bytes
Concurrency Level: 10
Time taken for tests: 1.629 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 46100 bytes
HTML transferred: 19100 bytes
Requests per second: 61.40 [#/sec] (mean)
Time per request: 162.862 [ms] (mean)
Time per request: 16.286 [ms] (mean, across all concurrent requests)
Transfer rate: 27.64 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 47 75 37.2 51 153
Processing: 47 76 38.2 51 158
Waiting: 47 76 38.2 51 158
Total: 94 151 74.9 103 304
Percentage of the requests served within a certain time (ms)
50% 103
66% 195
75% 221
80% 244
90% 271
95% 301
98% 303
99% 304
100% 304 (longest request)
What can I do to make things fasta?