我正在尝试一种与此图像详细描述的设置非常相似的设置:https://raw.githubusercontent.com/Oreste-Luci/netflix-oss-example/master/netflix-oss-example.png
(注:该链接可能需要翻墙才能访问) 在我的设置中,我使用了一个客户端应用程序(https://www.joedog.org/siege-home/),一个代理(Zuul),一个发现服务(Eureka)和一个简单的微服务。所有内容都部署在PWS上。我想从一个版本的简单微服务迁移到下一个版本而不会有任何停机时间。最初,我采用了这里描述的技术:https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html 在我看来,这种方法与像Eureka这样的发现服务不“兼容”。事实上,在我重新映射所有路由(CF Router)之前,我的服务的新版本已经在Eureka中注册并接收到流量。
这导致我采取了另一种方法,依赖于Spring Cloud / Netflix中的故障转移机制:
我启动了一个新的(向后兼容的)版本的服务。
当Zuul / Eureka选中此版本时,它开始获得50%的流量。
一旦我验证了新版本的正确性,就会关闭“旧”实例。(我只需在PWS中单击“停止”按钮)
据我所知,Zuul在底层使用Ribbon(负载平衡),因此在旧实例仍然在Eureka中但实际上正在关闭的那一刻,在新实例上进行重试而不影响客户端。
然而,我的假设是错误的。 我在客户端中收到了一些502错误:
Lifting the server siege... done.
Transactions: 5305 hits
Availability: 99.96 %
Elapsed time: 59.61 secs
Data transferred: 26.06 MB
Response time: 0.17 secs
Transaction rate: 89.00 trans/sec
Throughput: 0.44 MB/sec
Concurrency: 14.96
Successful transactions: 5305
Failed transactions: 2
Longest transaction: 3.17
Shortest transaction: 0.14
我的application.yml的一部分
server:
port: ${PORT:8765}
info:
component: proxy
ribbon:
MaxAutoRetries: 2 # Max number of retries on the same server (excluding the first try)
MaxAutoRetriesNextServer: 2 # Max number of next servers to retry (excluding the first server)
OkToRetryOnAllOperations: true # Whether all operations can be retried for this client
ServerListRefreshInterval: 2000 # Interval to refresh the server list from the source
ConnectTimeout: 3000 # Connect timeout used by Apache HttpClient
ReadTimeout: 3000 # Read timeout used by Apache HttpClient
hystrix:
threadpool:
default:
coreSize: 50
maxQueueSize: 100
queueSizeRejectionThreshold: 50
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 10000
我不确定出了什么问题。
这是技术问题吗?
还是我做出了错误的假设(我确实在某个地方读到过POST请求无法重试,但我并不完全理解)?
我很想听听你是如何处理的。
谢谢,Andy