Resolving the Feign/ribbon first request failure method in spring cloud

Source: Internet
Author: User

Objective

In spring Cloud, the feign and ribbon may have failed the first call after consolidating the hystrix, how do you solve the problem?

The cause of the problem

Hystrix the default time-out is 1 seconds, and if the time is not yet responding, it will enter the fallback code. The first request tends to be slow (because of the lazy loading mechanism of spring, to instantiate some classes), the response time may be more than 1 seconds. After knowing the reason, let's summarize the solution to put you.

There are three solutions, taking feign as an example.

Method One

?
1 hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 5000

The configuration is to change the Hystrix timeout to 5 seconds

Method Two

?
1 hystrix.command.default.execution.timeout.enabled: false

This configuration, which disables the timeout period for Hystrix

Method Three

?
1 feign.hystrix.enabled: false

This configuration is used to simply disable the feign hystrix. This practice is not recommended unless some special scenarios are used.

Summarize

The above is about the spring cloud to solve the Feign/ribbon first request failure of all content, hope that the content of this article on everyone's study or work can bring certain help, if there is doubt you can message exchange, thank you to the script home support.

Original link: http://www.itmuch.com/spring-cloud-feign-ribbon-first-request-fail/

Resolving the Feign/ribbon first request failure method in spring cloud

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.