[Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice

This article reprinted from "e-finance"

Author:

Jilin Province Rural Credit Cooperatives Information Technology Center 

Sun Gang, general manager, assistant general manager Cheng Yongyi

With the rapid development of mobile Internet, distributed architecture is widely used in the field of IT and Internet technology has accumulated a wealth of practical experience. In the rapid development of Internet banking and interest rate market environment, construction can support massive client, flexible scalability, efficient and flexible distributed architecture application system has become the domestic financial industry urgently needs.

Distributed database application trend
agency inclusive finance platform, designed to "make full use of financial technology means to optimize processes and customer credit evaluation model, reduce financing costs, relieve private enterprises, small and micro business financing financing your problem, enhanced the real economy, financial services capabilities. "
[Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice

Pratt & Whitney is a financial services typical of Internet applications, with traditional credit systems, have the ability to access the Internet scene, if followed centralized technical architecture, there are the following aspects of the massive potential customers of Internet application scenarios, and total cost of ownership in dealing with problem:

Centralized architecture generally lack the ability to elastically stretchable. With trading volume and data volume growth, the overall throughput of the system will encounter a problem or hardware technology. Especially when support for Internet-related business customers, can not effectively handle high transient outbreak of concurrent transactions, restrict the large-scale customer acquisition and marketing business.

Centralized architecture uses a single application design. The smallest unit of software development and management is running the application, and management and thick, easy to "affect the situation as a whole", the application development process is not easy to practice the lightweight agile development philosophy, system prone to single point of failure during operation, difficult to efficiently perform fault isolation.

Centralized architecture infrastructure systems typically use high-end servers and storage devices, as well as traditional relational database. The high cost of hardware and software procurement, development and operation and maintenance services mainly depends on the manufacturer, high service costs, can not be completely self-control.

Closed technology system, technology development is highly dependent on vendors, particularly dependent on foreign manufacturers, the commercial bank's IT team lacks self-control ability, there is information security risks to a certain extent.

我社在规划新一代普惠金融平台建设时,从战略高度对上述问题进行深入分析与思考,立足长远发展规划,从横纵两个角度看待该分布式系统的研发,即在数据方面着眼于分布式数据库,在功能层面则引入微服务架构,进而真正实现全方位分布式框架的金融服务底层系统。同时,响应国家对技术自主可控的要求,选择国产分布式数据库,有效控制IT成本和实现技术自主可控。

国产分布式数据库应用实践
普惠金融平台与传统业务系统不同,具有互联网场景接入能力,获客方式发生了变化。为了满足客户申请贷款的爆发式增长,在审批方式和流程上有所改变,对企业征信和智能风控的要求更高。随着细分领域竞争的加剧,平台应用需要不断调整、随时迭代。

经过仔细而严格的评选,最终我社采用国产分布式数据库—SequoiaDB巨杉数据库作为底层分布式数据库平台。

平台应用利用分布式数据库计算-存储层分离技术,将协议解析、计算等模块与底层存储解耦,存储层通过多维分区实现弹性扩张,计算层采用无状态设计,独立部署,通过动态增加数据库实例线性提升计算能力,有效应对瞬时爆发的高并发海量交易,分布式数据库平台同时完整兼容MySQL、PosgreSQL和SparkSQL针对应用提供较高兼容性。

平台应用开发基于Spring Cloud微服务框架,业务逻辑从传统的单一中间件被拆解成众多微服务组件,分布式数据库实例服务层提供了可选择、可适配、可动态伸缩的标准数据库计算引擎,可根据应用的场景灵活选择。应用开发采用数据库分布式计算引擎,面向联机交易的业务场景,采用兼容MySQL的计算实例,批处理业务场景选用兼容SparkSQL的计算实例。实例通过访问分布式数据库不同的数据副本,实现对数据的并行处理和多元利用(一份数据,多种用途)。

以下是联机业务应用分布式数据库的几个技术要点:

1.分布式架构下的应用设计

分布式数据库的核心机制即是将海量数据通过某种算法切分到一个或多个分区中。每个数据分区可以使用不同的物理服务器,通过网络设备将服务器连接到一起,以构成一个逻辑上对外统一的数据库服务。因此,如何将数据进行均匀切分、如何在切分后对数据进行快速检索,是分布式策略必须优先保障的内容。

分布式数据库切分规则包括:

(1)散列分区:散列分区指的是在数据写入的过程中,针对指定分区字段的值进行散列后,判断其数据物理存放分区的规则。
[Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice
 (2)范围分区:范围分区指的是在数据写入的过程中,针对指定分区字段的值判断其所在范围,根据数据所在范围对应的数据分区,判断其物理位置的规则。
[Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice
 (3)多维混合分区:多维混合分区是散列分区与范围分区的结合。在多维混合分区中,用户在建表时可以指定两个不同的字段,首先根据第一个字段进行范围的判定,之后再根据第二个字段在该范围所对应的一系列物理服务器中进行散列判断其位置。
[Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice

在我社新一代普惠金融服务平台项目中,对于数据库表结构的设计面向数据特征有针对性地定义分区字段与规则。在实践的过程中,极大提升应用的效率与并发能力,避免了传统架构中数据库成为瓶颈与热点的问题。

2.分布式微服务架构下的数据一致性保证

在利用分布式数据库系统实现底层业务支撑时,会带来很多传统集中式数据库无法比拟的特性,例如:分布式容错能力、弹性可扩展能力等,这些都是对银行等金融行业来说至关重要的优化因素。分布式数据库系统之所以能够具有这些能力,主要是因为它的分布式存储特性,即每个节点保存完整数据库的一部分,而在其它若干节点上部署它的副本。那么,为了实现这样的分布式数据库系统,使之发挥应有的能力,很重要的一环就是在于它的一致性策略。

在实践的过程中,我社重点研究并解决了行业内公认的分布式环境下端到端数据一致性与数据安全的难题:

(1)利用柔性事务保证微服务之间的数据一致性;

通过平台对分布式数据库在银行领域应用策略的研究,深入了解分布式底层技术,利用柔性事务TCC实现微服务之间数据一致性。普惠金融平台应用开发基于Spring Cloud微服务框架,应用程序微服务开发规范明确了每组微服务必须提供try-confirm-cancel接口,遵循对微服务的分布式事务所提出的RESTful TCC解决方案,结合Spring Cloud Netflix和分布式柔性事务实现微服务之间的数据一致性。

(2)在微服务内部,通过分布式数据库技术实现自动化事务一致性保障;

结合普惠金融系统业务数据的特点,合理运用数据多维分区策略,并利用分布式数据库技术,在两阶段提交(2PC)基础之上,针对异常故障场景,实现自动化的事务一致性保障。

为了保证数据的一致性,需要维护一个全局唯一性的ID来区别并发的事务,标识产生或变更的数据,实现这样一个全局唯一的ID通常结合事务发起的时间,依赖时间戳加上其他的一些标识位。国产分布式数据系统,专门设计了一套全分布的逻辑时钟机制,避免了强制所有参与节点从GTM中获取唯一ID的步骤,同时又能满足分布式存储和处理的要求。

3.分布式数据库跨同城数据中心部署

基于分布式数据库完善的多副本数据同步机制,实现跨同城双中心部署,支持数据的容灾与高可用,实现新一代普惠金融平台应用跨数据中心运行,当主中心出现灾难时,数据零丢失,分布式数据库自动容灾切换,对应用系统完全透明。下图是省联社普惠金融平台分布式数据库应用的双活部署示意图:

 [Sequoia] database SequoiaDB domestic provincial agricultural letter distributed database application practice

项目创新成果
1.分布式架构转型与金融国产化

分布式数据库提供灵活、弹性、便捷、融合的数据服务能力,应对瞬时爆发型业务量增长,与微服务架构相结合,为应用的敏捷迭代开发打下了良好的基础,快速推出创新、差异化、跨界的金融服务和产品。

Domestic use of distributed database giant sequoias database, the underlying code is completely self-control, to replace the foreign database products, to avoid binding core technology, two, two levels of performance and efficiency, short-term tactical applications from optimized hardware and software and long-term development strategy to optimize the two angles to achieve the overall comprehensive manner. In addition, taking into account the off-site disaster recovery, deployment and live practice of distributed data and applications through combining live for the future of data centers around the construction of rural credit cooperatives and other financial institutions to explore a practical way.

2.-end data consistency under distributed environment

During the practice, the agency also investigated and resolved under the industry recognized the end- to-end secure distributed environment data consistency and data problems: (1) the use of data to ensure consistency between the flexible micro-transaction service; (2 ) inside the micro-service, automated transactional consistency guarantees by distributed database technology; (3) using a distributed database system to solve the live data consistency across data centers and high availability issues.

In a virtualized cloud environment under micro-services framework, the agency completed a multi-level data consistency of distributed systems, thus achieving an efficient resilient scalable, eventually consistent transaction processing, micro-level data protection services and live in different places excellent features such as disaster recovery, provided a powerful impetus to further development potential and upgrade technology background and financial reform banks and other financial systems.

3. To achieve maximum economic efficiency and social

I clubs on the Internet finance industry conducted in-depth research, the common Internet finance business of refining, launched a strong and stable set of customer accounts, product innovation and build resilient multi-level mixed-platform system based on full cycle accounting, business automation for approval, intelligent risk control as one of the inclusive finance platform. The platform to provide customers with differentiated allocation of financial services, the completion of product integration, interactive services, accounting and other functions of the product of cross-border Internet. Not only provides a comprehensive package of inclusive finance, Internet financial services, but also for the rapid development of Internet financial services company has laid a solid foundation.

 

Guess you like

Origin blog.51cto.com/13722387/2465751