You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by "yhs0092 (via GitHub)" <gi...@apache.org> on 2023/02/27 12:21:44 UTC

[GitHub] [servicecomb-java-chassis] yhs0092 opened a new issue, #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

yhs0092 opened a new issue, #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685

   在 Java-Chassis 2.8.2 版本, `MicroserviceVersions`的契约加载逻辑从**单个微服务版本的契约只加载一次**改为了**每次实例列表有变化都重新加载一次契约**, 因此在provider端微服务实例列表变化时, consumer端的全部实例都要重新加载provider端契约.
   假设consumer端有 `n` 个实例, provider端有 `m` 个契约 `i` 个在网的版本, 则provider端有任何一次实例列表变化都将导致注册中心额外承载 `n * m * i` 次拉取契约的流量. 实际上, 由于微服务滚动升级上下线时还存在状态变化, 状态变化也算是实例列表变化, 流量问题可能更加密集. 而且契约的内容通常都比较多, 这也会导致注册中心的查询接口流量较大.
   
   和 @liubao68 了解过, 这次修改 (#3451 ) 是为了方便开发环境 consumer 端能够不重启微服务进程而加载到 provider 端的新接口契约. 但是这个机制导致业务现网可能面临注册中心过载的风险. 麻烦考虑给这个特性增加一个开关, 比如只有开发环境(`environment=development`)才重新拉取契约, 以降低现网的注册中心压力.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org.apache.org

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


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1447481046

   从功能设计的角度:(1)这个修改是需要保留的,允许覆盖契约可以有效降低大家改版本号的疑问。 (2)注册中心的压力应该能够支持这样的场景(所有实例单线程并发完成某个具体的功能),否则不可避免会导致一些意想不到的问题。 
   
   后续java chassis对契约管理有些新的想法,比如不强依赖注册中心必须具备契约。 目前其实已经具备一些机制,对于性能要求高的场景,可以考虑在客户端本地将服务端契约放进去,这样是最高效也能够保持兼容的处理方式。 相对于从注册中心拉取契约,唯一的麻烦就是手工放一下契约, 从性能、稳定性等很多方面都是有好处的。 
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


Re: [I] MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 closed issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


Re: [I] MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力 [servicecomb-java-chassis]

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1784363258

   2.8.x(2.8.12)依然维持版本号不变化不更新契约。 3.x.x(3.0.0)以后做调整,契约查询分散到具体微服务实例,不查询注册中心,可以极大的降低压力。 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1449164099

   从功能设计角度,网关动态感知契约变化是非常重要的功能,而不是依靠工程化手段保证, 这个方向应该是没错的。至于实现方式和对注册中心的压力,这个可以想想办法,注册中心需要满足一些重要功能的设计要求。  


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1447488416

   补充说明下重新加载契约可必要性:(1)gateway在微服务改变接口的情况下不重启;(2)老版本provider和新版本consumer先启动,然后升级provider到新版本场景。 
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

Posted by "yhs0092 (via GitHub)" <gi...@apache.org>.
yhs0092 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1447586682

   现网还是有必要保障微服务契约不能被覆盖的吧? 当前即使是 Java-Chassis 2.x 版本, consumer端调用接口也是要依赖provider端契约的. 假设业务使用新版本Java-Chassis开发微服务, 如果业务在新版本删除或修改了接口, 然后在现网误操作将旧版本软件包以新升级的版本号重新部署, 那么旧的契约会覆盖新的契约, 将导致一个instancePull周期内全部consumer都刷新成有问题的契约, 整个微服务的流量都会报错. 而在旧版本上, 微服务契约校验逻辑能够为业务拦截这种问题.
   
   业务应该要确保, 当接口契约变化时, 升级微服务的版本号, 这应该是对使用者的基本要求. Java-Chassis 应该在这一前提下做好拦截保护机制. 对于当前的 Java-Chassis 框架来说, 这样做对业务来说才是安全的. 为了开发态的方便而放弃现网的变更可靠性, 这种交换未见得是业务方预期的, 建议谨慎考虑一下吧, 所以建议应该让 consumer 端重新加载契约的行为仅在开发环境生效才保险.
   
   P.S. 也不是说热更新consumer端加载的契约不好, 而是说当前的 Java-Chassis 框架依赖契约做consumer端调用, 而新版本 Java-Chassis 的 consumer端会自动从注册中心刷新契约, 所以一旦有故障, **将会迅速扩散到全部 consumer 实例上**, 这是Java-Chassis 新版本新增的风险场景.
   如果哪一天consumer端的调用逻辑像原生的 `RestTemplate` 或者 Feign 一样, 是客户端定好的逻辑转发, 那也就无所谓这个问题了.
   
   >  注册中心的压力应该能够支持这样的场景(所有实例单线程并发完成某个具体的功能),否则不可避免会导致一些意想不到的问题。
   
    ---- 关于这一点, 以前升级的场景是 consumer 端不用重新加载旧契约, 只需要加载新契约即可; 而现在的场景, consumer端需要反复加载新旧版本的契约, 所以至少一定时间内总流量是翻倍的, 而且由于业务服务端多是滚动升级, 升级过程中涉及上下线, 可能每个实例都有多次实例状态的变化, 所以查询契约的流量应该显著高于旧版本.
   总之注册中心面临的压力会高于之前的版本, 建议宝哥还是跟 sc 的维护者沟通一下, 如果有风险可以提前告知各个业务, 或者在release note之类的地方明确标注一下.
   
   > 对于性能要求高的场景,可以考虑在客户端本地将服务端契约放进去,这样是最高效也能够保持兼容的处理方式。
   
   这一点可能有难度, 对于大型业务而言, 各微服务升级不是同步的, 而且他们依赖Java-Chassis框架的接口兼容性转发能力(`OperationInstancesDiscoveryFilter`提供的). 据我观察, 大部分业务在consumer端都是从注册中心加载契约的.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #3685: MicroserviceVersions每次刷新列表时都会加载契约, 会加大对注册中心的压力

Posted by "liubao68 (via GitHub)" <gi...@apache.org>.
liubao68 commented on issue #3685:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3685#issuecomment-1696688947

   > 补充说明下重新加载契约必要性:(1)gateway在微服务改变接口的情况下不重启;(2)老版本provider和新版本consumer先启动,然后升级provider到新版本场景。
   
   考虑到按照java chassis使用习惯,这2个场景并不实用。可以通过改变版本号实现gateway和consumer不重启。 后续会在客户端根据service id来缓存schema信息,service id不变化,则不重新从注册中心获取schema。 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

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