You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/10/12 03:30:59 UTC

[GitHub] [servicecomb-java-chassis] Sneackhack opened a new issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并使用快速重试

Sneackhack opened a new issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991


   根据优雅停机的描述,按自己的理解整理了下业务处理流程,不知理解得是否正确?
   https://docs.servicecomb.io/java-chassis/zh_CN/general-development/shutdown/
   组网是:微服务A调用微服务B1,微服务B2;有下面的疑问:
   1、当B1使用kill pid的方式进行优雅停机时,微服务A之前已经转发给B1上的请求(尚未回应的请求),微服务B1能否继续处理完,并正常回应给A;
   2、B1优雅停机期间,微服务A新的请求如果要转发给B1,微服务A如何快速感知到不能转发给B1,而重试其它实例,例如:转发给微服务B2?
   因为,我们的业务涉及端云交互,端侧最多等待云侧4秒钟(超时后会认为业务失败),因此,需要数据中心内微服务A进行业务重试时能快速感知到故障(例如:1秒内),并将请求发往其它微服务B2。
   根据下面的文档描述:注意: 并不是所有的异常都会触发重试。缺省的情况,只有网络异常,或者 503 错误码才会触发重试。 详细可以 参考 DefaultRetryExtensionsFactory 的定义。
   https://docs.servicecomb.io/java-chassis/zh_CN/references-handlers/loadbalance/
   想知道微服务A如何快速感知到B1在进行优雅停机?A发消息给B1,B1根据自身的stoping状态立刻返回A失败,让A快速感知到的吗?另外,B1的stoping状态何时切换为down状态?
   如果微服务B1的状态切换早了,微服务A之前已经转发给B1上的请求(尚未回应的请求)就处理不完,造成业务受损。
   
   相关资料:
   https://docs.servicecomb.io/java-chassis/zh_CN/general-development/shutdown/
   https://bbs.huaweicloud.com/blogs/107630
   https://docs.servicecomb.io/java-chassis/zh_CN/references-handlers/loadbalance/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706838565


   1. 可以
   2. 可以考虑将 service-center 设置为 watch 模式, 这样能够更加及时的感知B1下线。 另外,可以开启重试, 在B1优雅停机期间, B1 收到新的请求, 会返回503触发重试。 如果B1连接已经关闭, A连接B返回 SocketException, 也会触发重试。 
   
   有个测试可以参考: https://bbs.huaweicloud.com/blogs/107630
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Sneackhack commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
Sneackhack commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706992695


   > 优雅停机的流程可以参考 SCBEngine 的 doDestroy 方法。
   > 
   > 1. 可以
   > 2. 可以考虑将 service-center 设置为 watch 模式, 这样能够更加及时的感知B1下线。 另外,可以开启重试, 在B1优雅停机期间, B1 收到新的请求, 会返回503触发重试。 如果B1连接已经关闭, A连接B返回 SocketException, 也会触发重试。
   > Sneackhack问: 这个503错误码是微服务B1上的CSE 的SDK自动返回的吧?不需要微服务B1的APP层写代码吧?
   > 有个测试可以参考: https://bbs.huaweicloud.com/blogs/107630
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Sneackhack commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
Sneackhack commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706999141


   CSE优雅停机的局限性
   实例状态被标记为STOPPING后,同样会导致当前实例正在处理的请求无法再调用下游,会抛异常:The request is rejected. Cannot process the request due to STATUS = STOPPING。这是开发者需要注意的地方,如果业务无法接纳,那么还得提供其他额外措施。比如停止前,先做灰度引流,再停止服务。 
   -------》现在CSE还有这种缺陷吗?如果微服务B1标记为stopping后,之前A发送过来的请求,B1不能继续调用到下游微服务(例如:微服务C)吗?这种情况下,需要微服务B1的业务层遇到这种异常时,需要向A返回503错误码吗?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Sneackhack commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
Sneackhack commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-707009107


   > 有的。 这个可以改进下。
   -----》那如果使用当前的CSE SDK版本,这种情况下,需要微服务B1的业务层遇到这种异常时,需要向A返回503错误码吗?需要业务层写返回503错误码的代码吗?
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Sneackhack removed a comment on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
Sneackhack removed a comment on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706991557


   可以开启重试, 在B1优雅停机期间, B1 收到新的请求, 会返回503触发重试。----》这个503错误码是微服务B1上的CSE 的SDK自动返回的吧?不需要微服务B1的APP层写代码吧?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-707000198


   有的。 这个可以改进下。 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706995077


   是的,不需要。


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] Sneackhack commented on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
Sneackhack commented on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706991557


   可以开启重试, 在B1优雅停机期间, B1 收到新的请求, 会返回503触发重试。----》这个503错误码是微服务B1上的CSE 的SDK自动返回的吧?不需要微服务B1的APP层写代码吧?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 edited a comment on issue #1991: CSE优雅停机重试策略疑问:如何使consumer端能快速感知异常,并快速重试

Posted by GitBox <gi...@apache.org>.
liubao68 edited a comment on issue #1991:
URL: https://github.com/apache/servicecomb-java-chassis/issues/1991#issuecomment-706838565


   优雅停机的流程可以参考 SCBEngine 的 doDestroy 方法。 
   
   1. 可以
   2. 可以考虑将 service-center 设置为 watch 模式, 这样能够更加及时的感知B1下线。 另外,可以开启重试, 在B1优雅停机期间, B1 收到新的请求, 会返回503触发重试。 如果B1连接已经关闭, A连接B返回 SocketException, 也会触发重试。 
   
   有个测试可以参考: https://bbs.huaweicloud.com/blogs/107630
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org