1. Timeout: for example, the order service calls the product-service interface of the commodity service for order-service:
This interface requires a certain amount of response time. This exception occurs when you call it.
Solution: In the order-service configuration file application. yml, set the timeout time:
Timeout Configuration:
The default optons readtimeout value is 60, but because hystrix times out in 1 second by default, response timeout in 1 second is
Server: Port: 8781 # specify the Registry address Eureka: Client: serviceurl: defaultzone: http: // localhost: 8761/Eureka/# service name spring: Application: Name: order-service # custom Server Load balancer policy product-service: Ribbon: nfloadbalancerruleclassname: COM. netflix. loadbalancer. randomrule # modify call timeout 2 sfeign: Client: config: Default: connecttimeout: 2000 readtimeout: 2000
2. Adjust the load balancing policy when Feign is used
The Difference and choice between ribbon and feign
Select feign during development
1. ribbon is integrated by default.
2. clearer and more convenient ideas
3. Use annotations for configuration and facilitate deployment lockdown.
Therefore:
Feign is configured with the same Server Load balancer as ribbon. Default Round Robin is not configured,
If ribbon is configured, feign is configured, as shown in the configuration in the above file.
An exception occurred while calling the microservice. When feign is used, the SLB policy is adjusted.