美文网首页
网关设计规划

网关设计规划

作者: 飞天的龙王 | 来源:发表于2019-09-26 12:19 被阅读0次

Architecture upgrade:


1. Segregate codes into three different module:

    a. logic codes : which could be changed rapidly by requirement changed. e.g. API composite、API error handlers、business validation

    b. control codes: which could be complicated and more abstract but less rarely changed. e.g. sync、async、concurrent orchestration、networking flow

    c. operation codes: which could be tedious but can offer important info about service. e.g. logging,、metrics、healthy checks

2. Split codes vertically into three layer:

    a. access layer:provide edge functionality such as : version control、black/white list、authentication/authorization、flow control、traffic shaping、fuzing and degradation、caching、encryption/decryption

    Can be implemented to pluggable pipeline filter.

    b. API layer:providing features like: API composite、API error handlers

    c. base common layer:providing common functionality


Codes upgrade:

1. define a unified code naming and package 

2. pluggable interceptor mechanism 

3. domain self-contained logic and data,not coupled with dependency(API was stable but backend was variable)

4. simple and expressive payload 

5. general invoking


Security upgrade:

1. common networking security check: implement check to protect such as xss、ddos、xsrf、relay attack

2. authentication and authorization check(4A): integration with Authentication/Authorization service to auth/auth request.(Spring security/Shiro/Oauth2)

3. data desensitization and data encryption

4. invalid request attack

5. black/white list

6. tenant resource validation:validate resource operation is only to specified tenant (can use unified resource_id to match with tenant_id)

7. other customized process:implement  customized process


Performance upgrade:

1. remove db sore:

    a. query by cache: multilayer cache: local cache(query frequently、small size) → middleware cache(redis data cache) 

    b. persist directly in cache( cache provider as persistent store( redis AOF) ): request → middleware store(redis persistent data) 

    c. async transmit data to db: middleware store(redis) →  message service → DB

    d. other cache data flow: db →  message service → middleware cache

2. reactive communication: spring webflux monos to support async IO transmit and non-blocking IO integrated with event based functional programming

3. async invoking: use netty to do async invoking with backend service (directly use netty or other tech like spring cloud gateway extension to do integration)

4. concurrent orchestration:use mono to implement concurrent orchestration

5. serialization/deserialization: use more sufficient mechanism such as protobuffer、avro

6. data/cache pre-processing: pre construct static data/cache or half data

7. aggregate query:use batch query when big traffic with same kind of query request(need backend service support)


Stability upgrade:

1. limitation:rate limitation、fuzing and degradation、dynamic timeout mechanism

2. segregation:API、 API group、API module segregation with different in-service mechanism like semaphore、thread pool or alone service segregation

3. queued processing:queued data to post process and notified to front end

4. fail-fast mechanism style:use fail-fast mechanism style to avoid more unused traffic transmitted to backend service

5. retry/timeout mechanism:refactor retry/timeout mechanism to implement auto adjust retry policy/timeout value based on (a. config  b. avg timeout rate statistics) which avoid high latency backend service traffic

6. cache penetration:use different methods to protect penetration such as bloom filter、empty data caching


Operation upgrade:

1. health check: customized health check mechanism integration with Service discovery system and Load balancer

2. metrics :integration with Metric monitor system /Alarm system like Prometheus

3. tracing:integration with Distributed Tracing system like Zipkin、Cat

4. logging:integration with logging aggregation center like ELK

5. dynamic configuration/switch: integration with config center like Spring Config Server

6. exception:integration with exception management system like Sentry to do alarm or other error process

7. auditing:implement auditing functionality

相关文章

  • 网关设计规划

    Architecture upgrade: 1. Segregate codes into three diffe...

  • 亿级流量架构之网关设计思路、常见网关对比

    本文准备围绕七个点来讲网关,分别是网关的基本概念、网关设计思路、网关设计重点、流量网关、业务网关、常见网关对比,对...

  • 万能网关系统如何设计?

    本文准备围绕七个点来讲网关,分别是网关的基本概念、网关设计思路、网关设计重点、流量网关、业务网关、常见网关对比,对...

  • 网关与子流程

    网关 网关是用于控制流程的走向,也成为执行令牌,根据功能不同可以分为:排他网关,并行网关,包容网关,事件网关。 排...

  • 2018-03-27

    微服务网关 什么是微服务网关 微服务网关也称为服务网关或者API网关。服务网关 = 路由转发 + 过滤器...

  • 网关架构

    老网关架构: 新网关架构: 新老网关交易对比 老网关优点: 老网关不会存储任何数据,因此没有数据库的瓶颈。 老网关...

  • Activiti7的使用(六)

    Activiti的网关: 1、ExclusiveGateway:排他网关 排他网关(也叫异或(XOR)网关,或叫基...

  • 酸奶机

    计算机设计规划好的好好的

  • 如何展开设计思考流程

    虽然设计看的是结果,但对于设计规划者来说更重要的是推理思考流程,设计规划者哉这个流程中逐渐明晰业务、用户、设计目标...

  • 为什么需要后端网关

    一、什么是服务网关 二、为什么需要服务网关 三、服务网关技术选型 1、总体流程 2、引入网关的注意点 3、服务网关...

网友评论

      本文标题:网关设计规划

      本文链接:https://www.haomeiwen.com/subject/etfructx.html