Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Since finishing this article, senior technical expert Ali - Ali Yunfeng Xu Wenqi share in 2019 at the "technology platform - Distributed architecture practice in ants gold dress," and with reviews and interpret technical architecture community leadership expert, Ali comprehensive analysis technology architecture practice stations.

First, the advantage of distributed architecture and philosophy

1. The traditional architectural features of the monomer

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Usually a start-up project, are single architecture from the beginning.

The advantage is fast, easy to develop, test, deploy a WAR package made on production to get away.

Disadvantages are also obvious, because all modules in a program package, causes the compiler to slow, slow start, code violations, merge code each time is a nightmare, publishing success rate? Pure luck.

2. Micro Services Architecture vs single architecture

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Less complex applications when using higher monomer production efficiency, productivity monomer applications began to decline sharply when complexity to a certain size, then split them as a service is cost-effective.

The reason why micro-services architecture is widely recognized, from the business unpredictable variability, micro-service architecture to keep the self-evolution, and then quickly adapt to business changes.

3. Modular Development

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Micro-service architecture, from top-level design operations, beginning with the block split according to the service line, independent from the application presentation layer peeled monomers, logical layer, the data layer. Many companies have experienced monomer applied to the resolution process applications as a service, here to pay attention to business continuity, data integrity issues.

4. Load Balancing advantage of micro Services Architecture

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Usually before LVS, F5 load balancing as a service access layer, mainly to provide current limiting, load, security and so on.

In the micro-service architecture, the gateway of the access layer, providing lightweight load balancing, protocol conversion, authentication services, micro-services management frameworks usually has a service, such as DUBBO, to provide management services, service registration, service discovery and isolation.

The data access bottlenecks Solution - Vertical segmentation database

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Distributed architecture is how to solve the bottleneck of data access it? First, the database is a vertical slicing, for example, by a user, transactions, account split into a separate database which ease the pressure on the data storage and access, of course, may be prepared by the library shots, read and write separation.

6. Data Access Bottlenecks Solutions - Database level segmentation

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Next, the segmentation level of the database, such as databases and data traffic amount data table is too large, the table may be divided by transactions, sub-libraries, the number of split table calculation method shown above.

拆表拆库是解决数据访问、存储问题,但是会给数据查询带来很大的麻烦,比如跨多表、多库的复杂查询场景。解决的办法很多,通常有:用ES进行复杂查询,筛用ID再到库里捞数据(即复杂查询拆分多次查询),或用分布式海量数据库方案,不去做太细粒度的拆分库表,如下面会提到的OceanBase。

二、分布式架构实践举例--分布式TA系统

1.传统TA系统架构

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

传统TA系统架构,清算串行效率低,无法通过增加机器线性扩展性能,一般使用大事务,出现问题全部回滚。

2.分布式TA系统架构

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

分布式TA系统架构,结构更合理,也更复杂。分成了:接入层、业务服务层、SOFAStack层、LAAS、运维工具链、治理控制。

接入层:包括协议转换、访问控制、文件传输、运维工作台。

业务服务层:即业务核心逻辑服务,如:账户、交易、账单、清算等。

SOFAStack:蚂蚁金服的通用服务组件,许多都开源了,包括:微服务框架、分布式事务、任务调度、消息队列、数据代理、链路跟踪等。

分布式TA系统的需求攻克的技术难题。分布式清算任务如何高效实现?分布式下,加大应用处理出错可能性,那清算任务如何确保正确性?下面会谈谈如何解决。

3.分布式任务调度平台

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

分布式任务调度平台,支持:

自定义分片,高效利用集群计算能力。

执行中可对任务进行暂停/续跑,强制取消。

任务失败重试机制,保障整体计算任务成功。

4.清算任务调度

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

清算任务调度,整个架构分为:1)任务拆分,即申请交易文件,按一定的逻辑进行数据分片;2)任务执行,将执行处理过后的数据,存入流水库;3)核心服务,包括交易、清算、账务、账户等。

5.清算的容错和核对机制

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

清算的容错和核对机制,包含:日初始化、文件导入、清算处理、收益计算、份额调整、清算导出、二次清算、收益导出。

每个环节都可以冲正重做。

可以按文件、用户、备份点进行作业回滚。

优点是,任意流程可回滚、精准逐笔核对,支持按中台用户回滚,缩短了清算时长。

三、分布式架构下如何保障系统的可靠性及稳定性

1.灰度发布机制

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Gray-release mechanism, the process includes: beta release, group publishing, gray drainage, the total amount released.

Clearing gray, the user can flexibly by extraction slice dimension, shortening the time gradation.

2. Link-line pressure measurement

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Full link line pressure measurement, through the data access agent, the pressure measurement data into the shadow table line, does not affect the normal traffic data, Link-pressure characteristics are measured:

. ① environmental pressure measurement multiplexing production, reliable results; than the line.

②. Marking pressure measurement data can not enter the production environment, table-level isolation.

3.OceanBase high availability mechanism

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

OceanBase high availability mechanism, based on a typical three copies of Paxos protocol deployment:

1) strong data consistency;

2) continuously available;

3) automatic standby switch;

4) single, room, city-level fault: non-stop service, do not lose data;

OceanBase distributed database scheme is superior to commercial database of primary and library programs, mainly reflected in: a distributed database, a write transaction to reach more than half of the library, the library does not affect the business a few anomalies, three centers in two live, gray upgrade.

4.OceanBase common deployment scenarios

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

OceanBase deployment scenarios are:

Three room city , city plurality of core room, within a distance of 30 km, the delay between about 0.5 ~ 2ms;

Two three centers , delayed agreement under normal circumstances and the deployment of three-center city, one of the city's one ObServer downtime will increase off-site synchronization delay.

The city-active redundancy architecture

Ali experts say China-Taiwan: Taiwan technology - distributed architecture practice in ants gold dress

Active-active disaster recovery architecture city, usually in order to host the main room, carrying the daily transactions, traded away a small amount of engine room equipment, architecture is characterized by:

1) room with priority, to avoid cross-loss

2) application without any invasive

3) as a stand-alone application development and deployment as room

4) Automatic switching disaster recovery

Guess you like

Origin blog.51cto.com/14230003/2440644