awslabs / aws-c-s3

C99 library implementation for communicating with the S3 service, designed for maximizing throughput on high bandwidth EC2 instances.
Apache License 2.0
93 stars 37 forks source link

Implements Connection Pool Destroy Delay #412

Closed waahm7 closed 4 months ago

waahm7 commented 5 months ago

Description of changes: Problem: If the user makes requests serially, we destroy the connection pool between each request, which impacts performance.

Solution: Add a 3-second delay before destroying the connection pool, unless the Client is also being destroyed. If the user makes another request within those 3 seconds, the connection pool is not destroyed.

Benchmark: Downloading 1000 64Kb files in serial on c5n.18xlarge

Main Branch:
Run:1 Secs:33.994031 Gb/s:0.015423
Run:2 Secs:34.439879 Gb/s:0.015223
Run:3 Secs:35.191540 Gb/s:0.014898
Run:4 Secs:34.023091 Gb/s:0.015410
Run:5 Secs:34.815079 Gb/s:0.015059
Run:6 Secs:35.207595 Gb/s:0.014891
Run:7 Secs:36.181037 Gb/s:0.014491
Run:8 Secs:35.388686 Gb/s:0.014815
Run:9 Secs:35.315042 Gb/s:0.014846
Run:10 Secs:37.175047 Gb/s:0.014103
Overall Throughput (Gb/s) Median:0.014895 Mean:0.014916 Min:0.014103 Max:0.015423 Variance:0.000000 StdDev:0.000384
Overall Duration (Secs) Median:35.199567 Mean:35.173103 Min:33.994031 Max:37.175047 Variance:0.847040 StdDev:0.920348
Peak RSS:20.632812 MiB

This PR:
Run:1 Secs:21.822355 Gb/s:0.024025
Run:2 Secs:18.661068 Gb/s:0.028095
Run:3 Secs:16.470886 Gb/s:0.031831
Run:4 Secs:16.819767 Gb/s:0.031171
Run:5 Secs:15.395681 Gb/s:0.034054
Run:6 Secs:16.630556 Gb/s:0.031526
Run:7 Secs:16.218798 Gb/s:0.032326
Run:8 Secs:16.514378 Gb/s:0.031747
Run:9 Secs:17.100299 Gb/s:0.030660
Run:10 Secs:16.876424 Gb/s:0.031066
Overall Throughput (Gb/s) Median:0.031348 Mean:0.030650 Min:0.024025 Max:0.034054 Variance:0.000007 StdDev:0.002620
Overall Duration (Secs) Median:16.725162 Mean:17.251021 Min:15.395681 Max:21.822355 Variance:2.927835 StdDev:1.711092
Peak RSS:20.628906 MiB

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.45%. Comparing base (e91577e) to head (4c45503).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/awslabs/aws-c-s3/pull/412/graphs/tree.svg?width=650&height=150&src=pr&token=J4KP54FVLF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs)](https://app.codecov.io/gh/awslabs/aws-c-s3/pull/412?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs) ```diff @@ Coverage Diff @@ ## main #412 +/- ## ========================================== + Coverage 89.37% 89.45% +0.08% ========================================== Files 20 20 Lines 5854 5900 +46 ========================================== + Hits 5232 5278 +46 Misses 622 622 ``` | [Files](https://app.codecov.io/gh/awslabs/aws-c-s3/pull/412?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs) | Coverage Δ | | |---|---|---| | [source/s3\_client.c](https://app.codecov.io/gh/awslabs/aws-c-s3/pull/412?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL3MzX2NsaWVudC5j) | `88.40% <100.00%> (+0.23%)` | :arrow_up: | | [source/s3\_endpoint.c](https://app.codecov.io/gh/awslabs/aws-c-s3/pull/412?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL3MzX2VuZHBvaW50LmM=) | `91.87% <100.00%> (+1.50%)` | :arrow_up: |