Simmy & Polly

don't worry, be happy

The early days of the world

...there was a chaos.

At the early days of IT...

...there was an order

And we've turn it to this

Not if but when...

Don't worry, be happy?

Proin ac dolor nec nisi lobortis venenatis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec elementum est.

About us

- Jarek & Paweł

- OstraPiła podcast - 97 eps

- Ostra Uczy > 50 live streams

🦜

🏴‍☠️

Polly

Simmy

Polly

polly, polly, polly, ...

Two options

  • reactive
  • proactive

reactive

  • retry
  • circuit breaker
  • fallback
  • hedging

proactive

  • timeout
  • rate limiter

Simmy

arrrrrrrrrrrrrrr

Chaos

  • Exception
  • Result
  • Latency
  • Behavior

is it complex?

var retryStrategyOptions = new RetryStrategyOptions
{
    ShouldHandle = (_) =>                    ValueTask.FromResult<bool>(true),
};

var pipeline = new ResiliencePipelineBuilder()
    .AddRetry(retryStrategyOptions)
    .Build();

is it complex?

bool success = false;


pipeline.Execute(async () =>
{
    WriteLine($"Fetching {DateTime.Now}");
    var c = new HttpClient();
    var r = await c.GetAsync("http://ooops.pl");
    success = r.IsSuccessStatusCode;
});

is it complex?

Hello, World!
Trying to fetch data from network 26.04.2024 00:19:13
Trying to fetch data from network 26.04.2024 00:19:15
Trying to fetch data from network 26.04.2024 00:19:17
Trying to fetch data from network 26.04.2024 00:19:19
Success: False

 

is it complex?

is it complex?

var o = new RetryStrategyOptions
{
    ShouldHandle = (_) => ValueTask.FromResult<bool>(true),
};

is it complex?

var pipeline = new ResiliencePipelineBuilder()
 .AddCircuitBreaker(o)
    .Build();

is it complex?

while (true)
pipeline.Execute(async () =>
{
    Console.WriteLine($"Fetching {DateTime.Now}");
    var c = new HttpClient();
    var r = await c.GetAsync("http://ooops");
    success = response.IsSuccessStatusCode;
});

is it complex?

Trying to fetch data from network 26.04.2024 00:16:37
... 100 times later
Trying to fetch data from network 26.04.2024 00:16:37

Unhandled exception. Polly.CircuitBreaker.BrokenCircuitException: The circuit is now open and is not allowing calls.
   at Polly.Outcome`1.GetResultOrRethrow()
   at Polly.ResiliencePipeline.Execute[TResult](Func`1 callback)
   at Program.<Main>$(String[] args) in Program.cs:line 25

 

More info?

Polly & Simmy czyli

By Pawel Lukasik

Polly & Simmy czyli

  • 44