You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/10/26 07:32:33 UTC

[GitHub] [dubbo] 2227324689 commented on issue #10829: 关于ScopeModel的设计疑惑

2227324689 commented on issue #10829:
URL: https://github.com/apache/dubbo/issues/10829#issuecomment-1291618080

   > FrameworkModel -> ApplicationModel -> ModuleModel,中间的映射都是 1:N 的
   > 
   > 抽象这三个能力是为了实现 Dubbo 的多实例支持,FrameworkModel 是实现类似 JVM 租户级别的隔离,ApplicationModel 是为了实现一个机器上发布多个应用(如 demo-application1 和 demo-application2 一起发布),ModuleModel 是为了实现服务生命周期的独立管理(如一个 demo-application 可以由多个 Spring 容器共同提供)。
   > 
   > 所以一个 Dubbo 服务是对应到 ModuleModel 上的。
   > 
   > 举一个复杂一些的例子,比如:
   > 
   > 目前需要发布 DemoInterface1、DemoInterface2、DemoInterface3、DemoInterface4 四个服务 订阅 DemoService1、DemoService2、DemoService3、DemoService4 四个服务
   > 
   > 其中 DemoInterface1 和 DemoInterface2 由 demo-application-1 这个应用名发布(而且由 2 个 Spring Context 分别管理),DemoInterface3 和 DemoInterface4 demo-application-2 这个应用名发布 ,DemoService1、DemoService2、DemoService3、DemoService4 由 demo-application-3 这个应用名订阅。此外出于多租户的考虑,DemoInterface1、DemoInterface2、DemoInterface3、DemoInterface4 在 20880 端口和 20881 端口都独立发布,这 8 个服务(多租户 2 * 4 个服务)的实现都不一样。
   > 
   > 那么实际上 Scope 的层级结构是:
   > 
   > ```
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-1) -> ModuleModel (1.1.1 Spring Context 1) -> DemoInterface1 (bind on 20880)
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-1) -> ModuleModel (1.1.2 Spring Context 2) -> DemoInterface2 (bind on 20880)
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-2) -> ModuleModel (1.2.1 Spring Context) -> DemoInterface3 (bind on 20880)
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-2) -> ModuleModel (1.2.1 Spring Context) -> DemoInterface4 (bind on 20880)
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-3) -> ModuleModel (1.3.1 Spring Context) -> DemoService1
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-3) -> ModuleModel (1.3.1 Spring Context) -> DemoService2
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-3) -> ModuleModel (1.3.1 Spring Context) -> DemoService3
   > FrameworkModel (1) -> ApplicationModel (1.1 demo-application-3) -> ModuleModel (1.3.1 Spring Context) -> DemoService4
   > 
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-1) -> ModuleModel (2.1.1 Spring Context 1) -> DemoInterface1 (bind on 20881)
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-1) -> ModuleModel (2.1.2 Spring Context 2) -> DemoInterface2 (bind on 20881)
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-2) -> ModuleModel (2.2.1 Spring Context) -> DemoInterface3 (bind on 20881)
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-2) -> ModuleModel (2.2.1 Spring Context) -> DemoInterface4 (bind on 20881)
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-3) -> ModuleModel (2.3.1 Spring Context) -> DemoService1
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-3) -> ModuleModel (2.3.1 Spring Context) -> DemoService2
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-3) -> ModuleModel (2.3.1 Spring Context) -> DemoService3
   > FrameworkModel (2) -> ApplicationModel (2.1 demo-application-3) -> ModuleModel (2.3.1 Spring Context) -> DemoService4
   > ```
   > 
   > 上述所有服务独立工作,互相不影响
   > 
   > 这一块需要出一个具体的文档来说明(#10831)
   
   嗯,了解, Dubbo3目前还没支持多实例功能对吧。 


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org