Closed tschaffter closed 1 year ago
Even when proxying the requests to the API gateway, the org logos now show quickly on the org search page despite seemingly changing "nothing" for Thumbor aside creating a fresh Docker volume for it. I'm trying to understand why.
I reported the following benchmark results when downloading an image directly from Thumbor in #1641 .
vscode@0f6993f91f7e:/workspaces/sage-monorepo$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 36.368 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 2.75 [#/sec] (mean)
Time per request: 363.676 [ms] (mean)
Time per request: 363.676 [ms] (mean, across all concurrent requests)
Transfer rate: 26.46 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 186 364 211.3 247 866
Waiting: 186 363 211.2 247 865
Total: 186 364 211.3 247 867
Percentage of the requests served within a certain time (ms)
50% 247
66% 308
75% 591
80% 632
90% 722
95% 802
98% 865
99% 867
100% 867 (longest request)
After thinking to have figured out that the S3 result storage was what was taking so much time, I can't reproduce the previous time. The times I get now are much faster and are shown below;
Note The value of
Document Length
(assuming its the image size) is the same as in the above results, which is expected since the same image is used.
vscode@0f6993f91f7e:/workspaces/sage-monorepo$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 1.463 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 68.34 [#/sec] (mean)
Time per request: 14.633 [ms] (mean)
Time per request: 14.633 [ms] (mean, across all concurrent requests)
Transfer rate: 657.57 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 10 15 13.3 12 143
Waiting: 10 14 13.3 12 143
Total: 10 15 13.3 12 143
Percentage of the requests served within a certain time (ms)
50% 12
66% 13
75% 14
80% 16
90% 18
95% 21
98% 30
99% 143
100% 143 (longest request)
The only think that I can think of that is different is that I cleaned up ALL my Docker resources, including the volumes, which I haven't done in a long wail. Thumbor has been configured to use one of these volumes to store original images - while the processed images are saved to S3 - for a while now and maybe the volume got messed up (or may have filled up the 200M of memory allocated to the container as I've seen before cleaning the volumes), or the large collection of docker volumes slowed down Docker altogether?
The goal of this experiment is to evaluate the effect of cleaning all docker resources - but most importantly the volume used by Thumbor container - on the time it takes to download images from Thumbor.
sudo apt update && sudo apt install apache2-utils
main
branchdocker system prune
openchallenges-build-images
nx serve-detach openchallenges-apex
ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
and share the results here.docker stats
workspace-docker-stop
docker system prune --volumes
~ Disconnect the Thumbor data volume by commenting out this volumes block.@rrchai benchmarking results:
workspace-docker-stop
docker system prune --volumes -f
nx serve-detach openchallenges-apex
TPR: 409.437
TPR: 385.569
TPR: 369.577
500M
(keep Thumbor's volume)- TPR: 249.576
1000M
(keep Thumbor's volume)- TPR: 262.072
500M
(disable Thumbor's volume)- TPR: 258.811
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 30.529 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 3.28 [#/sec] (mean)
Time per request: 305.292 [ms] (mean)
Time per request: 305.292 [ms] (mean, across all concurrent requests)
Transfer rate: 31.52 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 149 305 179.1 202 690
Waiting: 149 305 179.1 202 690
Total: 149 305 179.1 202 690
Percentage of the requests served within a certain time (ms)
50% 202
66% 240
75% 536
80% 550
90% 632
95% 664
98% 677
99% 690
100% 690 (longest request)
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
1079044259e3 openchallenges-thumbor 0.00% 182.8MiB / 200MiB 91.38% 1.4MB / 1.46MB 48.5MB / 2.01MB 14
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 29.002 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 3.45 [#/sec] (mean)
Time per request: 290.022 [ms] (mean)
Time per request: 290.022 [ms] (mean, across all concurrent requests)
Transfer rate: 33.18 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 141 290 167.9 200 701
Waiting: 141 290 167.9 200 700
Total: 141 290 167.9 201 701
Percentage of the requests served within a certain time (ms)
50% 201
66% 223
75% 273
80% 550
90% 574
95% 641
98% 700
99% 701
100% 701 (longest request)
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 28.485 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 3.51 [#/sec] (mean)
Time per request: 284.853 [ms] (mean)
Time per request: 284.853 [ms] (mean, across all concurrent requests)
Transfer rate: 33.78 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 150 285 166.1 202 709
Waiting: 150 285 166.1 202 709
Total: 150 285 166.1 202 709
Percentage of the requests served within a certain time (ms)
50% 202
66% 216
75% 271
80% 538
90% 587
95% 645
98% 703
99% 709
100% 709 (longest request)
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
6986c2fea6e1 openchallenges-thumbor 0.00% 186.6MiB / 200MiB 93.28% 1.2MB / 1.26MB 33.6MB / 1.14MB 15
The reason Thumbor was responding faster for me is because result storage was disable, which is what I was exploring in this ticket but failed to revert because the property RESULT_STORAGE
was defined twice in .env
:
RESULT_STORAGE=thumbor_aws.result_storage
RESULT_STORAGE=thumbor.result_storages.no_storage # OVERWRITES THE PREVISOUS VALUE
thumbor/.env
:
RESULT_STORAGE=thumbor_aws.result_storage
...
Benchmark:
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 41.111 seconds
Complete requests: 100
Failed requests: 1
(Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Non-2xx responses: 1
Total transferred: 975610 bytes
HTML transferred: 950400 bytes
Requests per second: 2.43 [#/sec] (mean)
Time per request: 411.113 [ms] (mean)
Time per request: 411.113 [ms] (mean, across all concurrent requests)
Transfer rate: 23.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 159 411 276.0 266 1493
Waiting: 159 411 276.0 266 1493
Total: 159 411 276.0 266 1493
Percentage of the requests served within a certain time (ms)
50% 266
66% 384
75% 587
80% 701
90% 853
95% 970
98% 1075
99% 1493
100% 1493 (longest request)
Thumbor logs:
$ docker logs -f openchallenges-thumbor
2023-06-19 15:30:24 thumbor:INFO [RESULT_STORAGE] Image retrieved successfully at img-cache/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png.
2023-06-19 15:30:24 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 249.24ms
2023-06-19 15:30:24 thumbor:INFO [RESULT_STORAGE] Image retrieved successfully at img-cache/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png.
2023-06-19 15:30:24 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 251.02ms
...
thumbor/.env
:
RESULT_STORAGE=thumbor.result_storages.file_storage
Benchmark:
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 0.256 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 390.25 [#/sec] (mean)
Time per request: 2.562 [ms] (mean)
Time per request: 2.562 [ms] (mean, across all concurrent requests)
Transfer rate: 3754.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 1 2 1.5 2 10
Waiting: 1 2 1.3 2 9
Total: 1 3 1.5 2 10
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 3
90% 5
95% 6
98% 8
99% 10
100% 10 (longest request)
Thumbor logs:
$ docker logs -f openchallenges-thumbor
2023-06-19 15:36:32 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 5.45ms
2023-06-19 15:36:32 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 1.42ms
2023-06-19 15:36:32 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 1.37ms
...
thumbor/.env
:
RESULT_STORAGE=thumbor.result_storages.no_storage
Benchmark:
$ ab -n 100 http://localhost:8889/v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software: Thumbor/7.4.7
Server Hostname: localhost
Server Port: 8889
Document Path: /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png
Document Length: 9600 bytes
Concurrency Level: 1
Time taken for tests: 2.063 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 985300 bytes
HTML transferred: 960000 bytes
Requests per second: 48.48 [#/sec] (mean)
Time per request: 20.625 [ms] (mean)
Time per request: 20.625 [ms] (mean, across all concurrent requests)
Transfer rate: 466.51 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 12 21 27.7 15 287
Waiting: 11 20 27.7 15 287
Total: 12 21 27.7 15 287
Percentage of the requests served within a certain time (ms)
50% 15
66% 18
75% 21
80% 22
90% 27
95% 35
98% 42
99% 287
100% 287 (longest request)
Thumbor logs:
$ docker logs -f openchallenges-thumbor
2023-06-19 15:33:23 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 27.64ms
2023-06-19 15:33:23 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 12.46ms
2023-06-19 15:33:23 tornado.access:INFO 200 GET /v7P2QbvYYxWnBLJeePXFv-1Y0UY=/140x140/logo/dfci.png (172.21.0.1) 11.77ms
...
What projects is this story for?
OpenChallenges
As a user, I want
NA
Description
We have observed that images are displayed slowly in the web app. Sometimes images failed to be downloaded with an 500 error from the API gateway. After exploring the issue in #1641, I made the following observations:
The goal of this ticket is to make the following changes to Thumbor to improve its performance:
Acceptance criteria
No response
Tasks
No response
Anything else?
No response
Have you linked this story to a GitHub Project?