replace restbed by restinio
Parts
- OpenDHT: https://github.com/savoirfairelinux/opendht/pull/403 (merged)
- Jami-daemon: https://review.jami.net/#/c/ring-daemon/+/11959/ (in review)
Tasks
Find an alternativeTest async over a threadpoolBasic methods & threadingCompile OpenDHT in c++14Add RESTinio to OpenDHTFix flush happening after async scopeServer: Get,Put,Info,Stats,Options,PutEncrypted,PutSigned,Subscribe,Filter,Listen,PushServer: Cancel disconnected listeners by detecting a closed connection, Replace ThreadServer: Replace Scheduler task by Asio Timer making the entire server on one io_context that is run on one thread.Make an async RESTinio client with callbacks & integrate http_parserRewrite client side with an in-house std::async client libraryAdapt and test the behavior of proxy client to new async designVerify that keep alive is workingPatch for ISSUE-552: Configure the server to send keep alive every X min when X < 15 min)Make the RESTful API backward compatible to non-standard HTTP methodsRedirect server loggingIPV6 support: client & serverMake dhtproxytests passAdd docker setup for restinio & http_parser fork for Travis-CIBenchmark the proxy serverReplace Jami-daemon nameserver RESTbed by new OpenDHT Async ClientAdd OpenSSL to OpenDHT CMake & AutotoolsImplement OpenSSL in http lib (bridge GNUTLS Identity/Cert to OpenSSL in Asio)Implement HTTPS in DHTProxy (upstream is HTTP)Use HTTP or HTTPS depending on generated dht:crypto:Identity (-i)Write Docker files for OpenDHT with Travis CIIntegrate to the daemon autotools build system along with contribs (fmt, http_parser, restinio, ssl)Cross-compile on Jenkins: Linux, Arm, OSx, Windows
Benchmark
10'000 requests with concurrency of 20 requests
Compiled with:
cmake -DOPENDHT_TESTS=ON -DOPENDHT_PROXY_SERVER=ON -DOPENDHT_PROXY_CLIENT=ON -DCMAKE_INSTALL_PREFIX=/usr -DOPENDHT_PROXY_SERVER_IDENTITY=ON -DOPENDHT_DOCUMENTATION=Off -DOPENDHT_PUSH_NOTIFICATIONS=ON -DCMAKE_BUILD_TYPE=Release ../
Summary
- max_pipelined_requests: 16
- concurrent_accepts_count: 15
REST framework | Requests per second |
---|---|
RESTbed (multi-threded) | 12'677 |
RESTinio (one io_context thread) | 18'834 |
RESTinio (io_context on thread pool) | 12'719 |
- max_pipelined_requests: 7
- concurrent_accepts_count: 6
REST framework | Requests per second |
---|---|
RESTbed (multi-threded) | 12'677 |
RESTinio (one io_context thread) | 17'472 |
RESTinio (io_context on thread pool) | 11'800 |
Restbed: multi-threaded
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 180 bytes
Concurrency Level: 20
Time taken for tests: 0.789 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 2870000 bytes
HTML transferred: 1800000 bytes
Requests per second: 12677.48 [#/sec] (mean)
Time per request: 1.578 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 3553.16 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.2 1 3
Processing: 0 1 0.4 1 13
Waiting: 0 1 0.3 1 10
Total: 1 2 0.5 1 13
WARNING: The median and mean for the total time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 2
80% 2
90% 2
95% 2
98% 3
99% 4
100% 13 (longest request)
Restinio
- max_pipelined_requests: 16
- concurrent_accepts_count: 15
one thread for one io_context
Server Software: RESTinio
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 172 bytes
Concurrency Level: 20
Time taken for tests: 0.531 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 3130000 bytes
HTML transferred: 1720000 bytes
Requests per second: 18833.85 [#/sec] (mean)
Time per request: 1.062 [ms] (mean)
Time per request: 0.053 [ms] (mean, across all concurrent requests)
Transfer rate: 5756.83 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 0 1 0.3 1 7
Waiting: 0 1 0.3 1 6
Total: 1 1 0.4 1 8
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 8 (longest request)
io_context on thread pool
Server Software: RESTinio
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 172 bytes
Concurrency Level: 20
Time taken for tests: 0.786 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 3130000 bytes
HTML transferred: 1720000 bytes
Requests per second: 12718.92 [#/sec] (mean)
Time per request: 1.572 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 3887.72 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.2 1 3
Processing: 0 1 0.7 1 14
Waiting: 0 1 0.6 1 14
Total: 1 2 0.8 1 15
WARNING: The median and mean for the total time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 2
90% 2
95% 3
98% 4
99% 5
100% 15 (longest request)
- max_pipelined_requests: 7
- concurrent_accepts_count: 6
one thread for one io_context
Server Software: RESTinio
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 172 bytes
Concurrency Level: 20
Time taken for tests: 0.572 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 3130000 bytes
HTML transferred: 1720000 bytes
Requests per second: 17472.10 [#/sec] (mean)
Time per request: 1.145 [ms] (mean)
Time per request: 0.057 [ms] (mean, across all concurrent requests)
Transfer rate: 5340.59 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 7
Processing: 0 1 0.4 1 8
Waiting: 0 1 0.3 1 7
Total: 1 1 0.5 1 9
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 9 (longest request)
io_context on thread pool
Server Software: RESTinio
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 172 bytes
Concurrency Level: 20
Time taken for tests: 0.847 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 3130000 bytes
HTML transferred: 1720000 bytes
Requests per second: 11800.02 [#/sec] (mean)
Time per request: 1.695 [ms] (mean)
Time per request: 0.085 [ms] (mean, across all concurrent requests)
Transfer rate: 3606.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.4 1 6
Processing: 0 1 1.0 1 17
Waiting: 0 1 0.8 1 16
Total: 1 2 1.1 1 19
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 2
80% 2
90% 3
95% 4
98% 6
99% 7
100% 19 (longest request)