---
title: "What is Hedging strategy in Polly v8 and how to implement it in .NET?"  
description: "What is Hedging strategy in Polly v8 and how to implement it in .NET?"  
author: "Ravi Vishwakarma"  
published: 2026-08-17  
updated: 2026-08-17  
canonical: https://answers.mindstick.com/qa/117064/what-is-hedging-strategy-in-polly-v8-and-how-to-implement-it-in-net  
category: "Polly"  
tags: ["csharp", "dotnet", "polly", "hedging", "performance"]  
reading_time: 1 minute  

---

# What is Hedging strategy in Polly v8 and how to implement it in .NET?

Hedging executes additional concurrent attempts of an operation before the primary attempt finishes if it takes longer than expected. This decreases tail latency in high-availability systems.

## Implementing Hedging with Polly

Hedging is ideal for idempotent operations (such as HTTP GET queries) where receiving the fastest successful response is critical.

### Code Example

```cs
var pipeline = new ResiliencePipelineBuilder<HttpResponseMessage>()
    .AddHedging(new HedgingStrategyOptions<HttpResponseMessage>
    {
        MaxHedgedAttempts = 3,
        Delay = TimeSpan.FromMilliseconds(200),
        ShouldHandle = new PredicateBuilder<HttpResponseMessage>()
            .Handle<HttpRequestException>()
            .HandleResult(res => !res.IsSuccessStatusCode)
    })
    .Build();

var response = await pipeline.ExecuteAsync(async ct =>
{
    return await httpClient.GetAsync("https://api.example.com/data", ct);
});
```


---

Original Source: https://answers.mindstick.com/qa/117064/what-is-hedging-strategy-in-polly-v8-and-how-to-implement-it-in-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
