dig*_*oel 8 java spring hystrix spring-cloud netflix-zuul
我正在尝试使用spring-cloud-starter-zuul.我已经设置了Eureka并注册了一个我作为Eureka客户端编写的简单服务.我在具有两个不同应用程序名称的两个不同主机上注册了两个实例,因此它们是Eureka中的两个不同服务.我的目标是确保如果serviceA运行良好且serviceB执行效果不佳,则代理serviceA的代理不会因代理到serviceB而失败.
如果我通过zuul单独运行负载测试serviceA,我能够毫无问题地保持400 TPS吞吐量.如果我然后投入serviceB并完全超载它并让它在所有地方超时,我希望serviceA在serviceB flounders时继续400,但是serviceA降低到低于50 TPS成功率并且有一堆错误好.
似乎RibbonRoutingFilter产生的所有RibbonCommands在hystrix中共享相同的电路,这对我来说毫无意义.查看RibbonRoutingFilter创建RibbonCommand的地方,我没有看到任何方法将其配置为使用另一个.
在RibbonRoutingFilter中:
RibbonCommand command = new RibbonCommand(restClient, verb, uri,
convertHeaders(headers), convertHeaders(params), requestEntity);
Run Code Online (Sandbox Code Playgroud)
我已经验证了restAient对于serviceA和serviceB是不同的,所以他们正在使用他们自己的连接池配置,就像我在application.yml文件中指定的那样,但是serviceA和serviceA之间的服务质量仍然存在大量的交叉污染. serviceB.
似乎有另一个RibbonCommand的构造函数,它将"commandKey"作为第一个参数,我引用的那个只是委托给那个commandKey值为"default"的构造函数.我看不到在RibbonRoutingFilter中覆盖它的开关或选项.对我来说,这严重损害了Zuul在弹簧云项目中使用时的可行性.
有没有办法让我开箱即用,以便每个服务都有自己的电路?
我的pom的适用部分:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>1.0.0.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
application.yml:
ribbon:
ConnectTimeout: 5000
ReadTimeout: 5000
MaxAutoRetries: 0
MaxAutoRetriesNextServer: 0
OkToRetryOnAllOperations: false
MaxHttpConnectionsPerHost: 200
MaxTotalHttpConnections: 1000
echo1:
ribbon:
ActiveConnectionsLimit: 200
echo2:
ribbon:
ActiveConnectionsLimit: 400
spring:
application:
name: SpringCloudProxywall
server:
port: 8080
zuul:
routes:
echo1:
path: /echo1/**
serviceId: echo1
stripPrefix: false
echo2:
path: /echo2/**
serviceId: echo2
stripPrefix: false
Run Code Online (Sandbox Code Playgroud)
我的应用类:
@Configuration
@ComponentScan
//@EnableCircuitBreaker <-- is already included in EnableZuulProxy
@EnableZuulProxy
@EnableTurbine
@EnableHystrixDashboard
@EnableAutoConfiguration
public class SpringCloudProxywallApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudProxywallApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4567 次 |
| 最近记录: |