NeshaSerbia
NeshaSerbia

Reputation: 2542

Number of threads constantly rising ASP .NET Core

I have .net core web api application run on IIS. In some part of application I call wcf service for some information (asynchronous, use async await, etc) Sometimes that wcf service is unavailable and I get timeout (default is 1 minute) and then start problem. Because there's a lot of request for my API, and so on on wcf service, number of threads start to rise, at some point wcf service start to work normaly, but when my number of threads is over 200(I gues) it's start to rise constantly (1 thread per second, I guess) and it wont stop. My application is useless then and only way is to stop and start application pool on IIS, and my applications start to work normaly.

This is case one in a month, but I don't know what to do. I tried and chek a lot. Next try is to lower timeout when calling wcf service.

Upvotes: 0

Views: 1380

Answers (1)

Daniel Stackenland
Daniel Stackenland

Reputation: 3239

Sounds like the CircuitBreaker-pattern could help you?

The basic idea behind the circuit breaker is very simple. You wrap a protected function call in a circuit breaker object, which monitors for failures. Once the failures reach a certain threshold, the circuit breaker trips, and all further calls to the circuit breaker return with an error, without the protected call being made at all.

Read more at: https://martinfowler.com/bliki/CircuitBreaker.html

Upvotes: 2

Related Questions