Why does using ribbonReadTimeout don't break long request with Netflix Ribbon?
We are using Spring Boot 2.0.0.RELEASE with spring-cloud-starter-netflix-ribbon for our micro services. I set ribbon.readTimeout=1000
for slow requests and check it with our micro service setting breakpoint inside @GetMapping method without sending a response. In my test I have been waiting for 10 minutes and did not get any exception. It seems like there is no readTimeout at all.
Service configuration
ribbon:
ReadTimeout: 1000
my-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8080
ReadTimeout: 1000
ConnectTimeout: 1000
The only way a can make it work is ribbon.restclient.enabled=true
. But this client is deprecated and I don't wont to use it.
spring-boot spring-cloud spring-cloud-netflix netflix-ribbon
add a comment |
We are using Spring Boot 2.0.0.RELEASE with spring-cloud-starter-netflix-ribbon for our micro services. I set ribbon.readTimeout=1000
for slow requests and check it with our micro service setting breakpoint inside @GetMapping method without sending a response. In my test I have been waiting for 10 minutes and did not get any exception. It seems like there is no readTimeout at all.
Service configuration
ribbon:
ReadTimeout: 1000
my-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8080
ReadTimeout: 1000
ConnectTimeout: 1000
The only way a can make it work is ribbon.restclient.enabled=true
. But this client is deprecated and I don't wont to use it.
spring-boot spring-cloud spring-cloud-netflix netflix-ribbon
add a comment |
We are using Spring Boot 2.0.0.RELEASE with spring-cloud-starter-netflix-ribbon for our micro services. I set ribbon.readTimeout=1000
for slow requests and check it with our micro service setting breakpoint inside @GetMapping method without sending a response. In my test I have been waiting for 10 minutes and did not get any exception. It seems like there is no readTimeout at all.
Service configuration
ribbon:
ReadTimeout: 1000
my-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8080
ReadTimeout: 1000
ConnectTimeout: 1000
The only way a can make it work is ribbon.restclient.enabled=true
. But this client is deprecated and I don't wont to use it.
spring-boot spring-cloud spring-cloud-netflix netflix-ribbon
We are using Spring Boot 2.0.0.RELEASE with spring-cloud-starter-netflix-ribbon for our micro services. I set ribbon.readTimeout=1000
for slow requests and check it with our micro service setting breakpoint inside @GetMapping method without sending a response. In my test I have been waiting for 10 minutes and did not get any exception. It seems like there is no readTimeout at all.
Service configuration
ribbon:
ReadTimeout: 1000
my-service:
ribbon:
eureka:
enabled: false
listOfServers: localhost:8080
ReadTimeout: 1000
ConnectTimeout: 1000
The only way a can make it work is ribbon.restclient.enabled=true
. But this client is deprecated and I don't wont to use it.
spring-boot spring-cloud spring-cloud-netflix netflix-ribbon
spring-boot spring-cloud spring-cloud-netflix netflix-ribbon
asked Nov 20 at 7:06
Alexey Saltanov
82
82
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Not all the ribbon properties are supported by spring-cloud-netflix while being used with a Spring RestTemplate
. There are some ribbon properties that work, as described in the docs, but ReadTimeout
is not one of them. So it does not work, but it's by desing (as per the response to this issue). However, if you are using Spring's RestTemplate
, you can set it there directly, like so:
@LoadBalanced
@Bean
RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder
.setReadTimeout(2000)
.build();
}
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
add a comment |
We find this:
serviceA.ribbon.ReadTimeout=8000
work well with spring boot 2.1.0.RELEASE
using spring cloud Finchley.SR2
and
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
However, we use ribbon via feign, in a client as so:
@FeignClient(value = "serviceA")
public interface ServiceAClient {
@GetMapping(value = "/test")
String getTest();
}
We then use a wiremock test to introduce a fixed delay above the read timeout to verify it is working fine.
add a comment |
I think you need to configure Hystrix timeouts. Take a look at this part of the documentation : http://cloud.spring.io/spring-cloud-static/Edgware.RELEASE/single/spring-cloud.html#_hystrix_timeouts_and_ribbon_clients
It could be something like that :
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 1100
ribbon:
ConnectTimeout: 1000
ReadTimeout: 1000
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387857%2fwhy-does-using-ribbonreadtimeout-dont-break-long-request-with-netflix-ribbon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not all the ribbon properties are supported by spring-cloud-netflix while being used with a Spring RestTemplate
. There are some ribbon properties that work, as described in the docs, but ReadTimeout
is not one of them. So it does not work, but it's by desing (as per the response to this issue). However, if you are using Spring's RestTemplate
, you can set it there directly, like so:
@LoadBalanced
@Bean
RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder
.setReadTimeout(2000)
.build();
}
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
add a comment |
Not all the ribbon properties are supported by spring-cloud-netflix while being used with a Spring RestTemplate
. There are some ribbon properties that work, as described in the docs, but ReadTimeout
is not one of them. So it does not work, but it's by desing (as per the response to this issue). However, if you are using Spring's RestTemplate
, you can set it there directly, like so:
@LoadBalanced
@Bean
RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder
.setReadTimeout(2000)
.build();
}
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
add a comment |
Not all the ribbon properties are supported by spring-cloud-netflix while being used with a Spring RestTemplate
. There are some ribbon properties that work, as described in the docs, but ReadTimeout
is not one of them. So it does not work, but it's by desing (as per the response to this issue). However, if you are using Spring's RestTemplate
, you can set it there directly, like so:
@LoadBalanced
@Bean
RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder
.setReadTimeout(2000)
.build();
}
Not all the ribbon properties are supported by spring-cloud-netflix while being used with a Spring RestTemplate
. There are some ribbon properties that work, as described in the docs, but ReadTimeout
is not one of them. So it does not work, but it's by desing (as per the response to this issue). However, if you are using Spring's RestTemplate
, you can set it there directly, like so:
@LoadBalanced
@Bean
RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
return restTemplateBuilder
.setReadTimeout(2000)
.build();
}
edited Nov 20 at 17:19
answered Nov 20 at 17:01
OlgaMaciaszek
1,4301419
1,4301419
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
add a comment |
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
Thank you very much indeed. I've set request timeout for RestTemplate and now it works fine.
– Alexey Saltanov
Nov 21 at 11:18
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
@AlexeySaltanov I'm happy it was helpful. As it has solved your problem, could you please mark this answer as accepted and give it a +1?
– OlgaMaciaszek
Nov 21 at 11:24
add a comment |
We find this:
serviceA.ribbon.ReadTimeout=8000
work well with spring boot 2.1.0.RELEASE
using spring cloud Finchley.SR2
and
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
However, we use ribbon via feign, in a client as so:
@FeignClient(value = "serviceA")
public interface ServiceAClient {
@GetMapping(value = "/test")
String getTest();
}
We then use a wiremock test to introduce a fixed delay above the read timeout to verify it is working fine.
add a comment |
We find this:
serviceA.ribbon.ReadTimeout=8000
work well with spring boot 2.1.0.RELEASE
using spring cloud Finchley.SR2
and
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
However, we use ribbon via feign, in a client as so:
@FeignClient(value = "serviceA")
public interface ServiceAClient {
@GetMapping(value = "/test")
String getTest();
}
We then use a wiremock test to introduce a fixed delay above the read timeout to verify it is working fine.
add a comment |
We find this:
serviceA.ribbon.ReadTimeout=8000
work well with spring boot 2.1.0.RELEASE
using spring cloud Finchley.SR2
and
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
However, we use ribbon via feign, in a client as so:
@FeignClient(value = "serviceA")
public interface ServiceAClient {
@GetMapping(value = "/test")
String getTest();
}
We then use a wiremock test to introduce a fixed delay above the read timeout to verify it is working fine.
We find this:
serviceA.ribbon.ReadTimeout=8000
work well with spring boot 2.1.0.RELEASE
using spring cloud Finchley.SR2
and
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
However, we use ribbon via feign, in a client as so:
@FeignClient(value = "serviceA")
public interface ServiceAClient {
@GetMapping(value = "/test")
String getTest();
}
We then use a wiremock test to introduce a fixed delay above the read timeout to verify it is working fine.
answered Nov 20 at 17:10
David Goate
1,05521533
1,05521533
add a comment |
add a comment |
I think you need to configure Hystrix timeouts. Take a look at this part of the documentation : http://cloud.spring.io/spring-cloud-static/Edgware.RELEASE/single/spring-cloud.html#_hystrix_timeouts_and_ribbon_clients
It could be something like that :
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 1100
ribbon:
ConnectTimeout: 1000
ReadTimeout: 1000
add a comment |
I think you need to configure Hystrix timeouts. Take a look at this part of the documentation : http://cloud.spring.io/spring-cloud-static/Edgware.RELEASE/single/spring-cloud.html#_hystrix_timeouts_and_ribbon_clients
It could be something like that :
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 1100
ribbon:
ConnectTimeout: 1000
ReadTimeout: 1000
add a comment |
I think you need to configure Hystrix timeouts. Take a look at this part of the documentation : http://cloud.spring.io/spring-cloud-static/Edgware.RELEASE/single/spring-cloud.html#_hystrix_timeouts_and_ribbon_clients
It could be something like that :
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 1100
ribbon:
ConnectTimeout: 1000
ReadTimeout: 1000
I think you need to configure Hystrix timeouts. Take a look at this part of the documentation : http://cloud.spring.io/spring-cloud-static/Edgware.RELEASE/single/spring-cloud.html#_hystrix_timeouts_and_ribbon_clients
It could be something like that :
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 1100
ribbon:
ConnectTimeout: 1000
ReadTimeout: 1000
answered Nov 20 at 17:10
veben
1,0712921
1,0712921
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387857%2fwhy-does-using-ribbonreadtimeout-dont-break-long-request-with-netflix-ribbon%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown