[英]ruby/rails grpc server restart without disconnecting clients
I am using the following code snippet to start a grpc server which works fine. 我正在使用以下代码片段来启动运行良好的grpc服务器。 But whenever I need to deploy new code to the server, what is the right way for me to restart the server?
但是,每当我需要将新代码部署到服务器时,重新启动服务器的正确方法是什么? Should I just kill the server process, and let client to handle the error message?
我应该杀死服务器进程,让客户端处理错误消息吗? Or is there a way for enabling master/worker mode like unicorn does?
还是有办法像独角兽一样启用主人/工人模式?
s = GRPC::RpcServer.new
s.run_till_terminated
There is no such support for rolling out new deployments that's built in to the ruby-gRPC. 没有这样的支持来推出内置在ruby-gRPC中的新部署。
However, it should be possible for applications with multiple server instances to do rolling restarts. 但是,具有多个服务器实例的应用程序应该可以进行滚动重启。 Eg, note that if gRPC connects to a server and starts to make RPC's to it and that server gets shut down, then gRPC will internally notice that the connection went bad and it will try to make its next RPC on a newly connection (the default gRPC behavior will be to perform its next RPC on the next resolved address that can be successfully connected to, and this might mean reconnecting to the same address for which the connection just broke).
例如,请注意,如果gRPC连接到服务器并开始对其进行RPC,并且该服务器被关闭,则gRPC将在内部注意到该连接已损坏,并且它将尝试在新的连接上进行下一个RPC(默认gRPC的行为将是在可以成功连接的下一个解析地址上执行其下一个RPC,这可能意味着重新连接到刚断开连接的相同地址)。 Note too that gRPC servers use
SO_REUSEPORT
by default, so one could potentially run multiple servers on the same port. 还要注意,gRPC服务器默认情况下使用
SO_REUSEPORT
,因此一台服务器可能会在同一端口上运行多个服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.