General Framework principles:

1. The architectural idea of big middle stage + small front desk

2. Domain Driven Design (DDD) is adopted in the middle stage of the business, and business capability SAAS is built on it for continuous iterative evolution.

3. Platform-based positioning and business isolation design make it convenient for a system to support different business types of gameplay and facilitate customization expansion.

4. The front and back ends are separated and route adaptation and forwarding is implemented through the service access layer.

5. Natural sub-database and sub-table, message decoupling and distributed cache design, support elastic expansion, to support high concurrency scenarios of big data.

System logical Architecture Diagram:



Each section is described separately next.

E-commerce middle Stage:

The middle platform is logically divided into two layers of basic capabilities and platform products. The advantage of this is that the basic capabilities layer focuses on the stable converging business model and basic services themselves, which will not change with the adjustment of business and foreground products. It can be simply understood as the DAO of the business model. The platform product layer focuses on building basic capabilities into business solutions and solving common and personalized problems through technical means of process choreography. We will use the design of transactions as an example to illustrate this layering concept. Through in-depth analysis of e-commerce transaction business,

You can be sure that almost all deals will cover all of the areas shown below (inventory, offers, prices…). , and the gameplay of each domain is rarely changed. The basic abilities of these domains can be precipitated to form the basic abilities of atoms, so as to cope with the personalized expansion of special scenes in the future through extension points.



The product layer of the platform deals with different transaction scenarios (one-price, auction, CASH on delivery, pre-sale…). Orchestrate the basic capabilities of atoms into solutions that meet different scenarios and expose them as services.


Service Access Layer:

The service access layer is the link between the front end product and the middle stage product layer. In essence, it is the previous Web application. The difference is that after the separation of the front and back ends, it only contains Java code and uses springBoot Web. Do parameter conversion, route distribution, call center service, result encapsulation. This part needs to do the front and back end interaction specification, request route mapping specification, Web engineering directory structure, load balancing scheme, spanning problem and security problem,

We’ll talk about this in more detail later.

Common base components:

Precipitation and abstraction of common independent common infrastructure components, these components in the service of the project, the team at the same time, can be open source to serve more people; Pick a couple of very important components and talk about the purpose of doing this.

Data access components: abstract encapsulation sub-library sub-table access, read and write separation, master/standby switchover.

Message middleware components: The choice of this very much, just open source is the activeMQ, RabbitMQ, RocketMQ, Kafka, etc., plus ali cloud, AWS, tencent and provided corresponding cloud version, such as cloud will be very much, if not the do encapsulation, do transparent with its application, This adaptation can be painful later, especially when the system is deployed in different environments.

Address library components: unified geographic address related services, if there is the need to expand the international market, this will be very important, countries with different cultural backgrounds, in this area will be very different, at the same time, it also involves level 3, level 4 and level 5 address problems.

Cloud services & Facilities container layer

If the technical team is not very big, and there is no strong operational and technical personnel, suggest not to buy the physical machine built environment, but the more mature ECS directly use ali cloud and other cloud services, this will save a lot of time cost and work some time consuming operations, let its focus on business product research and development, at the same time use the docker container deployment, Not only does it require fewer machines but it is also very convenient and efficient to deploy.

Business Front desk products:

Ios, Android APP, H5 APP,PC site and wechat Alipay small program all belong to this layer. The front desk products are mainly constructed according to the business form and product positioning. For e-commerce business, mainly refers to the mobile APP mall, H5 mall, PC mall, small program mall. A small program will be used as an example.

In order to adapt to small programs, social electricity this hotspot, and there are so excellent a electricity middle system, don’t come up with something that has a kind of electricity product, reception is not very unreasonable, therefore want to broken head, we combine electricity and giving up, made a small program, reciprocity “below is a screenshot of the product.



Stability and safety assurance system

For such online trading systems as e-commerce, the flow will fluctuate greatly with the operation activities, especially when it comes to the double 11 event, the peak flow will be dozens to hundreds of times as usual, and some interfaces will be magnified more. The system indicators of the core system, flow rate, interface call quantity and RT, as well as the monitoring of current limiting and anomalies are very important. A few years ago, only BAT several large companies have the ability to do well in this aspect, with the mass participation of such large-scale promotional activities to promote the progress of technology, and the open source community and some large factories will return similar schemes to the open source community, now it is not difficult for a small technical team to do well in this area. Here is a brief introduction to the framework we use, please refer to the official documentation for more details.

Sentinel: Is a lightweight flow control product for distributed service architecture. It mainly focuses on traffic and helps you protect service stability from multiple dimensions such as flow control, fuse downgrading and system load protection. The system has been verified by Alibaba internal Double 11 years, with very good stability and reliability, and has been open source recently.

Dubbokeeper: Dubbokeeper. dubbokeeper community edition Dubboadmin, including application management, dynamic configuration, Statistics, service monitoring and ZK information viewing functions.

Pinpoint: now based on the micro service architecture, a request from the user initiated to response, the middle call link is very long, across dozens of systems is very normal, and the path is very much, to locate a more time-consuming response, do not use tools, is very inefficient. Pinpoint e tool is to deal with this problem, the advantage of the code zero invasion, the use of JavaAgent bytecode enhancement technology, track each request complete call link.

Telegraf+ influxDB+ Grafana: it is mainly used to realize real-time monitoring scheme of business data, such as abnormal fluctuation of trading volume, sudden drop of order volume, etc. Telegraf is an agent that collects data and can add plug-in extension services according to business needs. The collected data is written to the distributed timing database influxDB and presented visually by Grafana.

Engineering structure:

The logical structure is mapped to the physical engineering structure, and each logical unit corresponds to a sub-project. If it is developed with IDEA, it is a model, and of course there will be sub-models in the model. As to how much need to pack to build a system is the decisive factor is the size of your team if the team size small, middle system incorporated into the about 3-4 is enough, and if the group is very large, a team is responsible for a business sector, and build a multiple system, also is very normal, like large electricity company, responsible for the goods is a team, There are ten of them. Take the transaction as an example, it is possible to merge the systems of the transaction into one system, but they are opposite in the organizational structure of the project, which is convenient for the future split.


This time, we will introduce the overall framework, and there will be more articles that will introduce the core design in one or more topics per section. Interested in this piece of welcome to exchange technical solutions and product play.

For more articles, visit http://www.apexyun.com/

Public id: Galaxy 1

Contact email: [email protected] (please do not reprint without permission)