Closed abotalov closed 5 years ago
Persistent connections (keep-alive) significantly improve request-response cycle speed if the connection between hosts is not very fast.
On the other hand, if the connection is very good, persistent connections may reduce speed a bit
Below are details of the benchmark I made to check the performance improvement of persistent connections for our case.
I introduced a config option so it would be easy to check it in other scenarios too.
Benchmark 1 - remote endpoint
YAML file:
uuid: my-uuid endpoint: https://web.demo.reportportal.io launch: example_launch_name project: abotalov_personal formatter_modes: [skip_reporting_hierarchy, use_same_thread_for_reporting] disable_ssl_verification: false
Command (ran from my laptop, currently located in Spain):
for run in {1..5}; do bundle exec cucumber tests/features/ -r tests/features/ -f ReportPortal::Cucumber::Formatter; done
Execution time using persistent-benchmark branch:
persistent-benchmark
86.00392306 85.71174958 84.6365683 100.3799417 107.1182389
Average is 92 seconds.
Execution time using non-persistent-benchmark branch (the only change from persistent-benchmark branch is usage of non-persistent connections):
non-persistent-benchmark
305.279757 294.4467745 305.1522905 302.4168719 307.5853562
Average is 302 seconds. Time on master branch is similar, by the way.
master
So persistent connections improve speed by ~3 times under conditions of this benchmark.
Benchmark 2 - localhost endpoint
I ran the same command 20 times against Report Portal server on my laptop.
Average using persistent connection - 12.8 seconds. Average using non-persistent connection - 11.5 seconds.
So persistent connections were 10% slower for some reason.
Persistent connections (keep-alive) significantly improve request-response cycle speed if the connection between hosts is not very fast.
On the other hand, if the connection is very good, persistent connections may reduce speed a bit
Below are details of the benchmark I made to check the performance improvement of persistent connections for our case.
I introduced a config option so it would be easy to check it in other scenarios too.
Benchmark 1 - remote endpoint
YAML file:
Command (ran from my laptop, currently located in Spain):
Execution time using
persistent-benchmark
branch:Average is 92 seconds.
Execution time using
non-persistent-benchmark
branch (the only change frompersistent-benchmark
branch is usage of non-persistent connections):Average is 302 seconds. Time on
master
branch is similar, by the way.So persistent connections improve speed by ~3 times under conditions of this benchmark.
Benchmark 2 - localhost endpoint
I ran the same command 20 times against Report Portal server on my laptop.
Average using persistent connection - 12.8 seconds. Average using non-persistent connection - 11.5 seconds.
So persistent connections were 10% slower for some reason.