yammer/tenacity

Synchronous Timeout not getting honoured

Closed this issue · 6 comments

I am using tenacity to make a Network call . The execution isolation strategy is THREAD.
The thread timeout is set as 20 ms.
For 95 percentile requests the timeout is getting honoured, but for 98 and 99 percentile requests the time taken for getting response from Network Call is around 50-100 ms.

Are you looking at latencyExecute or the latencyTotal percentile values? The latencyTotal will include timings from short-circuited, timeouts etc.

I already raised the same issue in hystrix github repo. The only solution we could come up till now was to increase the number of HystrixTimer threads. The property exposed by hystrix for this is hystrix.timer.threadpool.deafult.coreSize .
Can you please tell me how do I set the same property using tenacity?

Tenacity doesn't expose anything directly to alter that specific property.

However, you should be able to adjust it using Archaius directly (which is what Tenacity does, https://github.com/yammer/tenacity/blob/master/tenacity-core/src/main/java/com/yammer/tenacity/core/properties/TenacityPropertyRegister.java). You should be able to use something very similar to this snippet of code:

ConfigurationManager.getConfigInstance().setProperty("hystrix.timer.threadpool.deafult.coreSize", 20);

Thanks , the issue is being tracked here Netflix/Hystrix#1196

Closing due to inactivity. Please re-open if there's more to discuss

Got the reason
Even though tenacity allows us to give separate threadpool and command keys to the command , it does not allow us to set a TenacityPropertyKey's timeout without giving threadpool and circuit-breaker properties for the command(thus effectively creating a new threadpool for each command key). This lead in my case to register few threadpool with timeouts thinking timeouts work in Hystrix at threadpool level. But timeout is a command key property in hystrix and hystrix originally honours timeout at command level rather than threapool level .

This maybe an issue with tenacity . My workaround: Separately registering command key timeouts using ConfigurationManager