io.timeout.millis specific to resource level

Not applicable

Is there any possibility to set HTTP response timeout ( io.timeout.millis ) specific to resource level?

The usecase is,

I have an API with multiple resources.In that one resource takes 120s to get the response from Target.But other resources takes 60s to get the response from same target.

Since io.timeout.millis is specific to HTTPTargetConnection common for a proxy,I am not sure whether we can override it for the only resource which is taking 120s.

Please let me know.

0 8 185
8 REPLIES 8

Hi @RK4

Are you setting it as 60 seconds which is timing out for the resource that takes 120 seconds ?

Why not have the timeout to 120 seconds so that other resources are not impacted ?

The other option is define a new Target End point just for this resource and using Route Rules and Condition, you can point to use this new target config that can have a timeout set to 120 seconds. You can re-use the same set of policies that are used in the default target end point.

<!-- Route rule for other target -->
<RouteRule name="second-target-endpoint">
    <Condition>(proxy.pathsuffix MatchesPath "/other")</Condition> <!-- /other is just an example here -->
    <TargetEndpoint>second-target-endpoint</TargetEndpoint>
</RouteRule>


<!-- Default -->
<RouteRule name="default">
    <TargetEndpoint>default</TargetEndpoint>
</RouteRule>

And within the "second-target-endpoint" configuation, you can have the property set

<Properties>
    <Property name="io.timeout.millis">120000</Property>
</Properties>

Hope this helps

@Sai Saran Vaidyanathan

Thanks for your response.

I will go with your second answer.

With first answer,the problem I see is,when the 60s resource is hit,and if there is a problem at Target side,then the proxy will not throw timeout error in 60s rather it will wait until 120s for the Target to respond.Due to this,SLA is violated as consumer expects timeout in 60s.

@Sai Saran Vaidyanathan

I see one redundancy issue in defining one more target.

Just for overriding this property,we need to create a separate Target but whereas the Targetendpoint is same in both the cases.

I feel this is not good design even if it solves separate io.timeout for 120s resource.

Is there anyother option or this is the only option right now?

Yes - I agree, thats why had asked about setting the overall timeout to 120 seconds. Let me get back to you if there any other options...

Yes @Sai Saran Vaidyanathan .But even there I could find the problem that I highlighted in my first comments.So,I am not satisfied much with both the options.Please let me know if there are other options.

@Subbu R

Not sure I understand the problem you are referring to. Also I don't see any other comments on this post from you. Let me know if I am missing anything here.

Are you saying that the second target end point with 120 seconds is not working ? Can you share the proxy and target end point code you are using ?

Not applicable

hoping the issue is already resolved. Just to highlight that this timeout is per connection. Also, just to highlight that connection will be released and reused as soon as response comes back. Negative side-effect of having high time out value is that connection will be held-up up to time out value if backend is behaving badly.

The issue is not yet resolved @rdoda.

And yes...I got that 120s timeout will impact the 60s target endpoint.Thatswhy I have not chosen this option.

For now,the only option I see is creating two target endpoints just for different HTTP properties.