43
微博搜索/丁振凯 2018.07.29 微博Service Mesh实践 —Weibo Mesh

微博Service Mesh - itdks.su.bcebos.com · 微博Service Mesh实践 - WeiboMesh 16 Service Mesh Meetup · BeiJing • 服务交互 • 服务发现 • 服务由 • 服务治 •

  • Upload
    others

  • View
    26

  • Download
    0

Embed Size (px)

Citation preview

  • 微博搜索/丁振凯2018.07.29

    微博Service Mesh实践—Weibo Mesh

  • Service Mesh Meetup · BeiJing�2微博Service Mesh实践 - WeiboMesh

    CONTENTS内容提要

  • 为什什么要做跨语⾔言服务化

    • 需求

    • 趋势

  • Service Mesh Meetup · BeiJing

    平台体系

    微博Service Mesh实践 - WeiboMesh �4

    Java Server

    Java Client

    Registry

    Motan

    ➢ 服务治理理

    ➢ 动态路路由

    Vintage

    ➢ 注册中⼼心

    Opendcp

    ➢ 智能弹性调度

    Graphite

    ➢ 实时统计监控

    平台微服务相关建设⽐比较完善

    Notify

    Subscribe

    Register

  • Service Mesh Meetup · BeiJing

    业务部⻔门调⽤用链

    微博Service Mesh实践 - WeiboMesh �5

    RPC A

    WEB A

    平台体系

    RPC B

    WEB B

    Golang 服务 PHP 服务 OR服务……

    RestF

    ul API

    业务部⻔门

    Motan

    ➢ 业务部⻔门语⾔言种类繁多

    ➢ 微服务体系建设不不完善/重复

    ➢ ⽹网络抖动,dns不不稳定

    ➢ 4,7层冗⻓长调⽤用链及资源消耗

    4,7层调度

  • Service Mesh Meetup · BeiJing

    趋势

    �6微博Service Mesh实践 - WeiboMesh

    微服务

    1

    容器器化

    2

    DevOps

    3

    云原⽣生

    4

    服务治理理与业务逻辑解耦,可持续交付

  • 跨语⾔言服务化⾯面临的问题

    • 改造成本

    • 服务治理理

  • Service Mesh Meetup · BeiJing

    改造成本

    �8微博Service Mesh实践 - WeiboMesh

    Server(php/java/..)

    golang/php/java

    Registry

    grpc/yar/motan

    ➢ 语⾔言特性

    ➢ 历史积累

    ➢ 业务侵⼊入较⼤大,client太重

    ➢ 性能

    ➢ 扩展性差

    ➢ 推⼴广困难

    Register

    Subscribe

    Notify

  • Service Mesh Meetup · BeiJing

    服务治理理

    �9微博Service Mesh实践 - WeiboMesh

    相同的治理理功能,不不同语⾔言的服务都要做⼀一遍?

  • Service Mesh Meetup · BeiJing

    跨语⾔言服务化的本质

    �10微博Service Mesh实践 - WeiboMesh

    • 协议中⽴立/跨语⾔言数据交互

    • 全⾯面/灵活可扩展服务治理理

  • Service Mesh Meetup · BeiJing

    跨语⾔言服务化⽅方式对⽐比

    �11微博Service Mesh实践 - WeiboMesh

      Http代理理 RPC模块 Agent代理理

    研发成本 低 ⾼高 中

    维护成本 低 ⾼高 中

    使⽤用成本 低 低 中

    治理理功能 中 ⾼高 ⾼高

    扩展能⼒力力 低 中 ⾼高

  • Service Mesh Meetup · BeiJing

    Service Mesh

    �12微博Service Mesh实践 - WeiboMesh

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

                                             

  • Service Mesh Meetup · BeiJing

    Service Mesh与微服务的切分

    �13微博Service Mesh实践 - WeiboMesh

    Service A Service B Service C

    微服务

    Weibo Mesh

  • Weibo Mesh⽅方案介绍

  • Service Mesh Meetup · BeiJing

    Weibo Mesh 总体架构

    �15微博Service Mesh实践 - WeiboMesh

    Weibo Mesh

    Service A

    Client

    Weibo Mesh

    Service B

    container container

    Registry

    Client

  • Service Mesh Meetup · BeiJing�16微博Service Mesh实践 - WeiboMesh

    • 服务交互

    • 服务发现

    • 服务路路由

    • 服务治理理

    • 跨语⾔言序列列化

    • 批量量请求

    • 资源服务化

    • 兜底逻辑

    Mesh Light ClientSM功能

    功能强化

    Go并发

    适配不不同语⾔言

  • Service Mesh Meetup · BeiJing

    Weibo Mesh 数据⾯面

    �17微博Service Mesh实践 - WeiboMesh

    ➢ Cluster(发现集群管理理,group + path)

    ➢ HA(⾼高可⽤用策略略)

    ➢ LB(负载均衡)

    ➢ Endpoint(服务节点的抽象)

    ➢ Protocol(Motan2/传输协议+Simple/序列列化协议)

  • Service Mesh Meetup · BeiJing

    Cluster 模块

    �18微博Service Mesh实践 - WeiboMesh

    WM/Client

    request Server

    WM/Server

    ⽬目标机器器请求机器器

    Client

    Cluster

    HighAvailable

    LoadBalance

    Filter Chain

    Transport

    Endpoint

    FilterChain

    Serialize

    Endpoint

    Endpoint

  • Service Mesh Meetup · BeiJing

    ⾼高可⽤用

    �19微博Service Mesh实践 - WeiboMesh

    HA➢Backup Request➢Failover➢…

    LB➢Weight➢Roundrobin➢Random➢…

  • Service Mesh Meetup · BeiJing

    Endpoint

    �20微博Service Mesh实践 - WeiboMesh

    ⽬目标机器器请求机器器

    Keep Alive

    Weibo Mesh

    Endpoint

    filter callserializechannels

  • Service Mesh Meetup · BeiJing

    Motan2 传输协议

    �21微博Service Mesh实践 - WeiboMesh

    Header

    ➢ 消息类型

    ➢ 协议版本

    ➢ 序列列化协议(body)

    Metadata

    ➢ 服务名

    ➢ ⽅方法名

    ➢ 系统参数及⽤用户参数

    Body➢ response➢ Request

  • Service Mesh Meetup · BeiJing

    Simple 序列列化

    �22微博Service Mesh实践 - WeiboMesh

    基础类型 复合类型

    type(1byte)+size(4byte)+content(${size} byte)

  • Service Mesh Meetup · BeiJing

    协议投递过程

    �23微博Service Mesh实践 - WeiboMesh

    WM

    ⽬目标机器器

    WM

    请求机器器

    client server

    motan2/simple

    provider

    http/cgi/…

    motan2/simple

    pointer

  • Service Mesh Meetup · BeiJing

    Weibo Mesh 控制⾯面

    �24微博Service Mesh实践 - WeiboMesh

    ➢ 策略略扩展:Filter Chain

    ➢ 流量量调度:MCS(Mesh Command System)

  • Service Mesh Meetup · BeiJing

    Motan Filter Chain

    �25微博Service Mesh实践 - WeiboMesh

    Access Log

    Metric

    CircuitBreaker

    Switcher

    Tracing

    Mock

    ActiveLimit

    Endpoint

    Req Res

    插件化

  • Service Mesh Meetup · BeiJing

    基于MCS的流量量调度

    �26微博Service Mesh实践 - WeiboMesh

    Vintage管理理系统决策系统

    Command DC1Servers

    DC2Servers

    DC1Clients

  • 业务实战

    • 正反向代理理

    • 收益及总结

  • Service Mesh Meetup · BeiJing

    正向代理理配置

    �28微博Service Mesh实践 - WeiboMesh

    motan-refer

    motan-basicRefer

    继承

    motan2://127.0.0.1:agent_port/service=path?group=group

  • Service Mesh Meetup · BeiJing

    正向代理理流程

    �29微博Service Mesh实践 - WeiboMesh

    php/OR/java

    Client

    Weibo Mesh

    register

    Filter

    HA+LB

    EndpointCluster

    degrade

    Registry

    Weibo Mesh

    motan2 snapshotEndpoint

    motan2

    serialize

    Register

    Discover

  • Service Mesh Meetup · BeiJing

    正向代理理特点

    �30微博Service Mesh实践 - WeiboMesh

    ➢ 业务平滑迁移

    ➢ agent故障转移,开关控制

    ➢ 多发,超时精确控制

    ➢ 适合⾮非云,混合云快速迁移

  • Service Mesh Meetup · BeiJing

    反向代理理配置

    �31微博Service Mesh实践 - WeiboMesh

    motan-service

    motan-basicService

    继承

  • Service Mesh Meetup · BeiJing

    反向代理理流程

    �32微博Service Mesh实践 - WeiboMesh

    Weibo Mesh

    Weibo Mesh

    NGINXPHP-FPM

    provider

    Restful

    handler

    Registry

    cgi

    cgi

    HTTP

    http

    filter

    registerdiscover

  • Service Mesh Meetup · BeiJing

    反向代理理特点

    �33微博Service Mesh实践 - WeiboMesh

    ➢ 提供HTTP/cgi provider,可扩展

    ➢ HTTP框架⾃自动转RPC,业务⽆无需开发新RPC框架

    ➢ 不不影响原有服务的提供

    ➢ 改造成本极低

  • Service Mesh Meetup · BeiJing

    Weibo Mesh的收益

    �34微博Service Mesh实践 - WeiboMesh

    1-跨语⾔言服务化

    3-可靠的Transport

    5-Http、Web⾃自动转RPC

    2-服务治理理与业务逻辑解耦

    6-适合⾮非云,混合云等,适配Registry⽀支持云原⽣生

    4-节省资源

  • Service Mesh Meetup · BeiJing

    Weibo Mesh在业务应⽤用中的效果

    �35微博Service Mesh实践 - WeiboMesh

    Mesh VS HTTP Backup Request 效果图

    20%~40%平均耗时 15%~50%SLA999

  • Service Mesh Meetup · BeiJing

                           

     热⻔门微博 wm      主站 wm     微博Feed wm   

                           

                           

      平台svA  wm      平台svB  wm     平台svC  wm   

                           

                           

      搜索svA  wm      搜索svB  wm      搜索svC  wm   

                           

    Weibo Mesh集群

    �36微博Service Mesh实践 - WeiboMesh

  • Service Mesh Meetup · BeiJing

    和Istio在数据⾯面和控制⾯面的区别

    �37微博Service Mesh实践 - WeiboMesh

    Weibo Mesh

    Filters

    Transport

    Mixer

    Envoy

    Pilot

    Citadel

    Istio

    Registry control plane

    data plane

  • Service Mesh Meetup · BeiJing

    和Istio在Discovery上的区别

    �38微博Service Mesh实践 - WeiboMesh

    Istio:Pilot适配云平台 WM:注册中⼼心

    云 VS ⾮非云

    WM

    Consul、ZK、Vintage

    WMEnvoy

    Pilot

    Envoy

    K8s、Mesos、Eureka

    Register Register

    Envoy API

    Adapter

  • Service Mesh Meetup · BeiJing

    和Istio在业务感知上的区别

    �39微博Service Mesh实践 - WeiboMesh

    服务透明 VS 模块耦合

    Istio:对服务透明

    •云原⽣生

    • IPtables流量量拦截

    •服务⽆无感知

    WM:模块化耦合

    •耦合度可选

    •定制化开发

  • Service Mesh Meetup · BeiJing

    WM未来发展⽅方向

    �40微博Service Mesh实践 - WeiboMesh

    泛服务化

    服务协议 版本号

    Servicemcq://host:port/0.1/helloworld.Greeter?group=group-hello

    ⽬目标节点

    服务分组

  • Service Mesh Meetup · BeiJing

    WM未来发展⽅方向

    �41微博Service Mesh实践 - WeiboMesh

    WM

    WM

    WM

    WM资源服务化

    MC

    Redis

    MySQL

    MCQ

    智能调度

  • Service Mesh Meetup · BeiJing

    Weibo Mesh开源项⽬目地址

    �42微博Service Mesh实践 - WeiboMesh

    WeiboMesh:https://github.com/weibocom/motan-go

    JAVA:https://github.com/weibocom/motan

    OR:https://github.com/weibocom/motan-openresty

    PHP:https://github.com/weibocom/motan-php

    Examples:https://github.com/motan-ecosystem/motan-examples

    @丁振凯

    https://github.com/weibocom/motan-gohttps://github.com/motan-ecosystem/motan-examples

  • Thanks 



    Q&A

    丁振凯

    微博搜索