Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Http.Resilience] Add support of the HTTP resilience for synchronous HttpClient requests #5333

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

iliar-turdushev
Copy link
Contributor

@iliar-turdushev iliar-turdushev commented Aug 2, 2024

The PR adds support of the HTTP resilience for synchronous HttpClient requests. This is achieved by implementing a synchronous method Send in the ResilienceHandler.

Microsoft Reviewers: Open in CodeFlow

Resolves #5236

@iliar-turdushev iliar-turdushev self-assigned this Aug 2, 2024
@iliar-turdushev iliar-turdushev changed the title [Http.Resilience] Add support of resilience for synchronous HttpClient requests [Http.Resilience] Add support of the HTTP resilience for synchronous HttpClient requests Aug 2, 2024
@iliar-turdushev iliar-turdushev marked this pull request as ready for review August 2, 2024 17:19
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@RussKie

This comment was marked as resolved.

Adds StandardPipeline and Retry benchmarks for synchronous HttpClient requests
@iliar-turdushev
Copy link
Contributor Author

iliar-turdushev commented Aug 5, 2024

Added StandardResilience and Retry benchmarks for synchronous HttpClient requests. In summary,

  • Benchmarks for asynchronous HttpClient requests (existing functionality) haven't changed. Benchmarks for Polly v8 are worse than for Polly v7 though.
  • Benchmarks for synchronous HttpClient requests (new functionality) are a little bit better than asynchronous Polly v8 benchmarks.

StandardResilience benchmarks

Current version (WITHOUT support of synchronous requests)

|                    Method |     Mean |     Error |    StdDev | Ratio | RatioSD |   Gen0 | Allocated | Alloc Ratio |
|-------------------------- |---------:|----------:|----------:|------:|--------:|-------:|----------:|------------:|
| StandardPipeline_Polly_V7 | 2.999 us | 0.1279 us | 0.1915 us |  1.00 |    0.00 | 0.4463 |    3736 B |        1.00 |
| StandardPipeline_Polly_V8 | 3.295 us | 0.1321 us | 0.1895 us |  1.11 |    0.10 | 0.1183 |    1008 B |        0.27 |

New version (WITH support of synchronous requests)

|                         Method |     Mean |     Error |    StdDev | Ratio | RatioSD |   Gen0 | Allocated | Alloc Ratio |
|------------------------------- |---------:|----------:|----------:|------:|--------:|-------:|----------:|------------:|
|      StandardPipeline_Polly_V7 | 2.709 us | 0.0199 us | 0.0266 us |  1.00 |    0.00 | 0.4463 |    3736 B |        1.00 |
|      StandardPipeline_Polly_V8 | 3.150 us | 0.0749 us | 0.1050 us |  1.16 |    0.03 | 0.1183 |    1008 B |        0.27 |
| StandardPipeline_Polly_V8_Sync | 3.018 us | 0.0495 us | 0.0726 us |  1.12 |    0.03 | 0.1030 |     864 B |        0.23 |

Retry benchmarks

Current version (WITHOUT support of synchronous requests)

|         Method |       Mean |    Error |    StdDev |     Median | Ratio | RatioSD |   Gen0 | Allocated | Alloc Ratio |
|--------------- |-----------:|---------:|----------:|-----------:|------:|--------:|-------:|----------:|------------:|
| Retry_Polly_V7 |   935.5 ns | 68.30 ns | 102.23 ns |   876.4 ns |  1.00 |    0.00 | 0.1602 |    1344 B |        1.00 |
| Retry_Polly_V8 | 1,333.1 ns | 64.91 ns |  95.14 ns | 1,310.6 ns |  1.45 |    0.22 | 0.0973 |     824 B |        0.61 |

New version (WITH support of synchronous requests)

|              Method |       Mean |    Error |   StdDev | Ratio | RatioSD |   Gen0 | Allocated | Alloc Ratio |
|-------------------- |-----------:|---------:|---------:|------:|--------:|-------:|----------:|------------:|
|      Retry_Polly_V7 |   837.9 ns | 23.20 ns | 31.76 ns |  1.00 |    0.00 | 0.1602 |    1344 B |        1.00 |
|      Retry_Polly_V8 | 1,222.3 ns | 26.05 ns | 34.77 ns |  1.46 |    0.08 | 0.0973 |     824 B |        0.61 |
| Retry_Polly_V8_Sync | 1,062.4 ns |  3.27 ns |  4.58 ns |  1.27 |    0.05 | 0.0801 |     680 B |        0.51 |

Copy link
Member

@eduherminio eduherminio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iliar-turdushev iliar-turdushev merged commit 0cd4e2e into main Aug 8, 2024
6 checks passed
@iliar-turdushev iliar-turdushev deleted the iliarturdu/resilience-http-sync branch August 8, 2024 10:07
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronous HttpClient Methods Do Not Use Retry Resiliency Strategy
4 participants