Dubbo-01

1.Dubbo profile:

    1.Dubbo is a distributed, high-performance, RPC service frame transparency (RPC: Remote Procedure Call protocol)

     2.SOA:

        1. English name (Service Oriented Architecture)

        2. Chinese name: service-oriented architecture

            2.1 There is a special service unit.

            2.2 All other units are calling this service.

        3.SOA positioning:

            3.1 How to design projects, make more efficient the development.

            3.2 SOA is an idea

        4. Project architecture before

            4.1 All items in the company are not allowed to access the database project.

            4.2 development, database access layer code might appear redundant


Before the project architecture

        5. Use SOA architecture

           5.1 special access to database services (project).

            5.2 can achieve development, data access control and code reuse.


SOA architecture

        6. When implementing SOA architecture, common services.

            6.1 Dubbo as a service.

            6.2 WebService as a service.

            6.3 Dubbox as a service.

            6.4 is a web service side project, call controller web project.

                6.4.1 Use HttpClient controller can call other projects.

  3 RPC: one kind of service requests from a remote computer through a network, without having to understand the underlying network protocol technology

    1. English name (Remote Procedure Call Protocol)

    2. Chinese name: Remote Procedure Call protocol

    3. RPC Analysis: Client (A) call to a remote server over the Internet, do not know the specific implementation of the remote server, the remote server provides only know what function.


RPC调用服务

    4. RPC 最大优点:

        4.1 数据安全性.

2.Dubbo的作用:三大核心能力:

    1.面向接口的远程方法调用

    2.智能容错和负载均衡

    3.服务自动注册和发现

3.Dubbo架构图:


dubbo架构图

    1.Provider:提供者,服务的发布方

    2.Container:Dubbo容器,依赖于Spring容器

    3.Consumer:消费者,调用服务方

    4.Registry:注册中心,当Container(容器)启动时,将所有可以提供的服务列表上Registry中进行注册

        4.1 作用:告诉Consumer提供了哪些服务,服务方在哪里

    5.Monitor:监听器

    6.深蓝色虚线:在启动时完成的功能

    7.浅蓝色虚线与实线:在程序运行过程中执行的功能

    8.虚线代表异步访问,实线代表同步访问

        注意:图中可知只有服务调用时才是同步访问,同时也是最耗时的地方,必须是同步

    9.所有的角色都可以在单独的服务器上,所以必须遵守特定的协议

4.Dubbo的运行原理:

    英文单词:

    start:开始  

    register:注册  

    subscribe:订阅    

    notify:告知

    invoke:调用

    count:统计

    4.0 启动容器,相当于在启动Dubbo的Provider

    4.1 启动后会去注册中心进行服务注册,注册所有可以提供的服务

    4.2 在Consumer启动后会Registry获取获取服务列表和Provider的地址,进行订阅

    4.3 当Provider有修改后,注册中心会把消息推送给Consumer

        4.3.1 此处使用了观察者设计模式(又叫 发布/订阅模式)

    4.4 Consumer根据获取到的Provider地址,真实调用Provider的功能

        4.4.1 在Consumer方使用了代理设计模式,创建一个Provider方类的一个代理对象,通过代理对象获取Provider中的真实功能,作用是保护了Provider方的真实功能

    4.5 Consumer和Provider 每隔一定的时间向Monitor发送统计信息,统计信息包含,访问系数,频率等

5.Dubbo支持的注册中心

    1. Zookeeper(推荐)

        1.1 优点:支持网络集群

        1.2 缺点:稳定性受限于 Zookeeper

    2. Redis

        2.1 优点:性能高.

        2.2 缺点:对服务器环境要求较高.

    3. Multicast

        3.1 优点:面中心化,不需要额外安装软件.

        3.2 缺点:建议同机房(局域网)内使用

    4. Simple

        4.1 适用于测试环境.不支持集群

6.Zookeeper 简介

    1. Zookeeper 分布式协调组件.

        1.1 本质一个软件.辅助分布式的搭建和管理

    2. Zookeeper 常用功能

        2.1 发布订阅功能 .把 zookeeper 当作注册中心原因.

        2.2 分布式/集群管理功能.

        2.3 分布式锁

    3. 使用 java 语言编写的.

 

Guess you like

Origin www.cnblogs.com/binblog678/p/11586280.html
01