Talking about the construction of distributed architecture-theoretical knowledge

Talking about the construction of distributed architecture


Architects generally prioritize security, stability, and high throughput. Haha, as a rookie, I asked me to install a B and recall the previous architecture

basis

idea

    CAP (consistency, availability, partition fault tolerance) is impossible to achieve all three, and two can be achieved at most. In system construction, here are a few points of priority for system construction discussion, from high to low for safety, stability, and high throughput (the discussion of the system scheme is in the "key scheme design")

Technical selection

In fact, the technical selection of a framework is determined based on the actual use of the business scenario, and the selection of technology types through multiple technical comparisons. The method of comparison was limited in my personal ability at the time. I made full use of my industry knowledge and consulting human resources and Inquiring industry papers, it is said that I cannot be a giant, but I can see a certain height on the shoulders of giants.
    Here we mainly talk about front and back ends and mobile terminals, front-end vue, back-end java, mobile-end android WebView and h5. Here is a brief introduction of how to simple technology, the specific description in the following scheme

The front-
     end front- end basic framework uses vue, the page rendering PC end element-ui and mobile end VUX. We'd better carry out secondary encapsulation of element-ui. Set the development specifications, recommend using eslint constraints and typeScript, development tools using vs code and tool related configuration. The previous personal setup was set as the following
vs code:

{
 "files.autoSave": "off",
 "workbench.startupEditor": "welcomePage",
 "vetur.validation.template": false,
 "update.channel": "none",
 "editor.formatOnSave": false,
 "editor.tabSize": 2,
 "editor.fontSize": 16,
 "editor.detectIndentation": false,
 "vetur.format.defaultFormatter.js": "vscode-typescript",
 "vetur.format.defaultFormatter.html": "js-beautify-html"
}

The eslint design specifications are as follows :

module.exports = {
 //此项是用来告诉eslint找当前配置文件不能往父级查找
 root: true,
 globals: {
   http: true,
   $: true,
   Swiper: true
 },
 parser: 'babel-eslint',
 //此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
 parserOptions: {
   ecmaVersion: 6,
   sourceType: 'module'
 },
 //此项指定环境的全局变量,下面的配置指定为浏览器环境
 env: {
   browser: true,
   node: true
 },
 // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
 // 此项是用来配置标准的js风格,就是说写代码的时候要规范的写,如果你使用vs-code我觉得应该可以避免出错
 extends: 'standard',
 // required to lint *.vue files
 // 此项是用来提供插件的,插件名称省略了eslint-plugin-,下面这个配置是用来规范html的
 plugins: [
   'html'
 ],
 // add your custom rules here
 // 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
 // 主要有如下的设置规则,可以设置字符串也可以设置数字,两者效果一致
 // 'off' -> 0 关闭规则
 // 'warn' -> 1 开启警告规则
 //'error' -> 2 开启错误规则
 // 了解了上面这些,下面这些代码相信也看的明白了
 rules: {
   // allow async-await
   'generator-star-spacing': 'off',
   // 回调
   'standard/no-callback-literal': 0,
   // allow debugger during development
   'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
   // 强制在 function的左括号之前使用一致的空格
   'space-before-function-paren': 0
 }
}

Back-end java
    focuses on several keywords: java8, jvm tuning and design , maven, git, Alibaba protocol (if you want points, ask me to give it) , spring boot/cloud basic framework (sofa or spring cloud alibaba), docker or linux deployment container. Our Java version uses jdk8+, it is recommended to use Apache open source and Alibaba protocol, use the development tool ide, and install Alibaba protocol plug-in. Use maven as the build tool, and build your own maven component library. The version control tool used is git or gitlab.      In fact, the
mobile terminal WebView and h5
have better Internet products landing for the financial industry, such as mpass, here is just a brief explanation, you can write WebView to achieve js interaction with the front-end h5 page, and h5 can use VUX.

Back-end technical design

This is just a technical introduction and will not go into details. In addition, when building a technical solution, it is not a RPC or Redis cluster cache when it comes up. This is a wrong approach. Each of our architectures are built based on business driving, and we also design DDD design concepts. Recommended infrastructure: technical architecture spring boot, database persistence layer architecture mybatis, database mysql sub-database sub-table (horizontal split, vertical split), scheme design (visio&UML&ppt case architecture design, power design database design, axure prototype design) , Interface debugging tools (swagger-ui and postman). The following is the technical selection of the individual’s previous building system, the black is the individual’s adopted technology

Microservice architecture RPC : spring cloud , spring cloud alibaba, dubbo, personally used spring cloud before, and later spring cloud alibaba
monitoring became popular : Cat , Zipkin, Pinpoint, SkyWalking
registry : consul , zookeeper, euroke, previously suggested by the industry Consul, later China closed its source.
Configuration center : apollo , nacos, spring cloud config, dynamic configuration
cache tool : redis or memcache, you can use distributed transactions in combination with spring session : 2PC, TCC concept, redis to achieve transactions , MQ to achieve asynchronous, zookeeper solutions or database ACID features. Current limiting and fuse : Hystrix fuse, through sentinel current limiting API gateway scheduling : spring cloud gateway and personally written gateway ...



Data transmission : use json transmission, Jackson (ObjectMapper) and gson and DTO, VO, VO, PO concept
persistence layer access : mybatis
message queue : RabbitMQ, RocketMQ, ActiveMQ, Kafka, IBMMQ , but RocketMQ is recommended here

Overall architecture design

After combining the above technology selection, it is to compile structural design drawings, mainly as follows

  1. Logical architecture
  2. System integration architecture
  3. Physical deployment structure
  4. Database design drawing
  5. System center module split
  6. Flow control, gateway, central module split
  7. The dual-active solution design, the problem to be considered in the same-city dual-active is the cache

Key case design

The key scheme design is to drive design in the DDD field. In fact, it is to split the big scheme into small schemes and complete them independently. The small schemes are then merged to achieve the big scheme. The following points need to be considered (individual)

  1. High concurrency query (sub-database and table, sql optimization and cursor query using mybatis, cursor query is closed, so you need to get sqlsession or @Transational transaction)
  2. No session mechanism (database cache or third-party caching tool redis)
  3. Log specification (log desensitization filter, link tracking snowflake algorithm)
  4. Monitoring platform (data buried point cat)
  5. Public components (HandlerInterceptor interceptor unified processing upload and download, database selection and shardingsphere, redis repeated submission, token idempotent verification, sm2 signature verification)
  6. Security design (cross-site scripting attack filter, filter and statement preprocessing to prevent sql attack, cross-site forgery attack cross-domain verification)
  7. Front and back separation (movement and static separation, nginx server, static file server)
  8. Unified message return
  9. Unified exception handling (ControllerAdvice).
  10. JVM parameter setting and GC algorithm setting
  11. Performance pressure test Jmeter

Stay tuned for more attention. I hope to write a tutorial for each technical point when I have time!

Past work notes:

1、概述
安全性、稳定性、apache和互联网产品落地案例

使用技术
语言、微服务架构、日志监控、监控、RPC框架、配置中心、注册中心、
分布式事务、缓存工具、分布式事务、限流和熔断、API网关调度、数据传输

swagger-ui和postman
构建工具、迭代工具、部署工具(Docker和linux)

开发工具

设计理论:DDD


2、总体架构设计
逻辑架构
系统集成架构

3、关键方案设计
高并发查询
无会话机制
日志规范(日志脱敏、链路跟踪)
监控平台(数据埋点)
公共组件(上传下载、数据库、重复提交、幂等校验)
安全设计(跨站脚本攻击、sql攻击、跨站伪造攻击)
前后分离(动静分离)
统一报文返回,统一异常处理。

5、未来发展计划
流量控制、网关、中心模块拆分
双活方案设计
概念性描述

Guess you like

Origin blog.csdn.net/soft_z1302/article/details/111249637