“This article has participated in the call for good writing activities, click to view: the back end, the big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”

Since 2020, Baidu has started to build its own product promotion system. Currently, the system is applied in hundreds of numbers and live broadcast scenarios, providing convenient delivery process for B-end merchants, c-end authors and anchors, and providing a direct and simple shopping experience for the majority of users. This paper introduces the product promotion system according to the order of business concept, user interface, system architecture and core implementation, aiming to throw a brick to introduce jade, hoping to bring readers thinking and help.

The full text is 5874 words, and the expected reading time is 12 minutes.

I. Overview of promotion process

The “Brief Analysis of order System Architecture of Baidu Trading Center” mentioned last time tells the realization method and iterative process of order system. Based on the order system, this issue continues to introduce the design and implementation of promotion system.

Commodity promotion system is a common system in e-commerce platform with goods. * Treasure union, * East Union, more than * Jinbao are similar product promotion systems. In today’s society, with the prosperity of knowledge payment, short video and live broadcasting, the threshold for the public to express themselves has been lowered, and more and more content creators (in the era of short video, most of the content creators are authors or anchors) have a strong influence. Therefore, the commodity promotion system for merchants and authors (anchors) is very important. This commodity promotion system connects both ends of BC and greatly liberates productivity.

Commodity promotion system around the author (anchor), businesses, users as the core, to provide a platform that can simultaneously serve the three. In the promotion process, different roles have a special address, the author (anchor) called traffic master, called advertisers.

(1) Traffic master

The goal of the merchandising process is to maximize the transaction. The general way to promote a product is to increase the exposure of the product and increase the clicks of the product. The more people see the product, the higher the possibility of facilitating a transaction. The product promotion system is to promote together with influential anchors or authors to expand their influence, which is commonly referred to as “bringing goods”. The purpose of this program is to achieve the goal of promoting products by influencing influential people and by brand effect and celebrity effect. The authors or anchors who participate in the promotion process are called [traffic masters] because they can help the order system attract traffic. The anchors and authors who participate in the product promotion process are collectively referred to as traffic masters below.

(2) Advertisers

In the common product promotion process, in order to attract more traffic master to join in the promotion, according to the category of goods, a commission proportion will be designed for each order as appropriate. If consumers purchase goods through the entrance provided by the traffic master, the traffic master will get a certain proportion of commission rebate. The amount of rebate is provided by the merchant or the platform, and there are different strategies according to different scenarios.

For businesses that need to promote products, a promotion process is equivalent to a wide advertising of products, but the advertising may not necessarily come from an advertising company, but may also come from a little-known ordinary people. These business roles, in the promotion process, are vividly called [advertisers].

(3) the CPS

With the development of science and technology, 3G and 4G networks have turned mobile payment into the “steam engine” of the Internet revolution, while 5G and big data have made information three-dimensional. The merchandising process builds on both and provides the opportunity for more people to participate in the transaction. The common e-commerce platforms basically support the promotion of commission sharing. In the e-commerce market landscape, the commission sharing action is generally realized through CPS.

CPS, short for Cost Per Sales, is a common charging method in product promotion. It is charged by actual Sales volume, which is more suitable for promotion of shopping apps, but accurate traffic is required for data statistical conversion.

Ii. Business characteristics of Product promotion process of Baidu

CPS promotion with goods needs to provide services to users from three different dimensions, corresponding to the traffic owners (anchors + authors), advertisers (merchants) and users (consumers) mentioned above. Meanwhile, the construction of the whole CPS promotion system also starts with function disassembling from these three points. It can be split into three user interface services and five internal core services.

(Figure 1: Baidu’s overall delivery system construction)


(1) Three user interfaces

As can be seen from Figure 1, the product promotion system mainly has three user interfaces, namely, the B end of the small program for advertisers, the product selection interface for traffic owners, and the order purchase interface for users. The three interfaces are described below.

Advertiser interface part, small program B side service as business side, for advertisers to provide commodity registration services, that is, advertisers can in the small program background interface, open goods with goods, so as to promote their goods.

(Figure 2: Opening interface of small program B with goods)

(Figure 3: User revenue interface of small program B)

In the actual delivery process, developers can open the delivery as advertisers, which has a certain development cost (such as Dangdang, Amazon, etc.); Baidu also provides a complete set of shop opening services, which can be involved in the product promotion process (such as small shops) at a very low cost.

In the main interface of traffic, hundreds of numbers and livestream ecology serve as the entrance of selection services, providing convenient and quick introduction of products for the host and authors. In this part, baidu’s own system products can also be introduced.

(Figure 4: Editor selection interface of Hundred)

The above picture is the editing interface of hundred. The flow is mainly through the editing button to add goods, you can select goods from the commodity library, and embed the goods window in the article. If the product link embedded in the article is clicked by ordinary users and placed a successful order, the order will be counted as a promotion of traffic master according to certain rules. In the interface of hundred live, you can also select products and add product links, which will not be described here.

(Figure 5: Product selection platform selection interface)

Figure 2 shows the product selection interface of Baijia. It can be seen that the product selection not only includes the commission products of Taobao, JINGdong and Pinduoduo, but also includes some selection libraries with Baidu characteristics, including Duxiaodian, Dangdang, Amazon and Movie Piaoyou, etc.

User interface part, and advertisers, order goods, small program to display interface is dependent on the baidu, such products are designed to facilitate the baidu APP sharing within the matrix on the technical implementation, advertisers goods interface, only need to develop a, can be in all the baidu ecological demonstration and promotion within the APP.

(Figure 6: User interface)

The user interface is mainly for consumers. When consumers watch the live broadcast or the author’s article, if the live broadcast or article contains product promotion, they can purchase goods according to the process shown in Figure 6. The goods purchased at this time are from the product promotion system.

(2) Five core services

By combing the user interface, the product promotion system can be split according to function points. In the implementation of this issue, it is split into 5 core services. Services are shown in the table below:

Among the five core services, the mounting service and promotion service are redesigned and developed for the scenario of commodity promotion, while the trading system, settlement system and asset system are the existing capabilities of the trading platform.

(3) Build a promotion process with Baidu characteristics

Since 2020, Baidu has set out to establish a product promotion system within the group. In the process of system construction, it faces many technical challenges, mainly in the following aspects:

  • Baidu business product matrix formed by multiple APPS, how to provide a unified technical implementation scheme, so that both traffic owners and advertisers can enjoy the best quality products and services

  • How to effectively collect the user’s promotion behavior in the colorful and changeable page

  • How to integrate existing order and settlement systems and export a standard model for payment and settlement

Just list some of the big questions above points, in detail, there are many at the front desk can’t see, but very affect experience problems, such as traffic advocate hit after the effective promotion, is the need to assign the commission, the commission part how to implement, after the distribution of commission how can we truly become traffic main income? For example, as advertisers, how to finalize the quantitative to see their own promotion record? There is always money involved and anyone wants to look at it carefully.

However, apart from the challenge, starting from the trading platform to build CPS promotion system, the start is standing on the shoulders of giants. Relying on the transaction ability at the bottom, it can quickly establish a set of CPS promotion implementation, and fully reuse the existing capabilities in business, including placing orders, capital pool, asset accounting, withdrawal, etc., can be quickly realized. Technically, it can rely on the underlying framework of the transaction to achieve the function quickly.

Iii. Realization of product promotion services

(Figure 7: Mount Service && Promotion Service Architecture Diagram)

Although mount service and promotion service play a very important role in the complex product promotion system, from the design point of view, their functions are relatively single after separate separation, which also conforms to the standard of high cohesion and low coupling between systems.

In the figure above, services are divided into four layers in a hierarchical design, from top to bottom, as follows:

Business layer: This layer refers to the abstract business, which can be extended by multiple service providers. Different service providers are accessed from different angles, including advertisers, traffic owners and users.

Access layer: This layer provides services for the service layer, such as traffic forwarding, service authentication, and load balancing. In addition to the functions of the regular gateway, the access layer separates the different traffic on both sides of the BC (B for merchants and C for users). The transaction unified gateway mainly undertakes the traffic from consumers. The gateway is characterized by a large number of user requests but relatively simple. Therefore, performance and security are the main considerations for the design of the gateway in terms of non-functional requirements. Among them, the open platform of e-commerce (trade.baidu.com) serves as the gateway entrance of the merchant side. The access volume of this part of gateway is not so high, so it mainly focuses on business processing and association.

Service layer: This layer is the core service provider, including foreground and background services.

Dynamic library: the core front-end component of commodity promotion, mainly responsible for promotion data reporting, and need to ensure security and data legitimacy;

Registration service: this is a background service, to provide advertisers with the main flow of registration and opening, and with the lower commodity system, settlement system to provide commodity import, cent commission proportion setting function, is a link, data registry;

Mount service: Mount service provides window link generation and data authenticity verification after commodity registration

Promotion service: as the core back-end component of commodity promotion, it receives promotion records and reports from the dynamic database externally, and receives promotion judgment of order orders from the trading system internally.

Component layer: This layer relies on various middleware within the dimension to quickly implement functionality.

For promotion record and mount service, the design difficulty lies in the connection with the overall system, the business itself is relatively single, worth introducing here includes two parts, one is based on dynamic library promotion record report, the other is based on database batch write write optimization.

(1) Promotion record reporting based on dynamic library

[Dynamic library] is a framework component provided by Baidu applet, which can provide basic capabilities for applet by bypass, such as ECharts chart, Editor rich text editor, etc. The product dynamic database uses this bypass design method to embed in the developer’s product details page, and can obtain the complete extension parameters of the product page. (copy the link to view applet dynamic library official document: smartprogram.baidu.com/docs/develo…

(Figure 8: Schematic diagram of small program dynamic library)

The applets dynamic library is shown in the figure above. The top layer is the purchase page of the order, the bottom layer is the running container of the applets, and the middle layer is the dynamic library. Dynamic library is a basic library that is dynamically loaded on demand and released by some specific small program business platforms (such as Daso and Phoenix Nest), which can provide some business functions or constraints of the business platform. Dynamic library has the following characteristics:

  • Dynamic library will update silently, the dynamic library publisher decides to update, small program developers can not decide when to update.

  • Dynamic libraries can provide custom components or JS modules for applets to use.

  • The dynamic library publisher can only be Baidu now.

  • The use of dynamic libraries requires the developer to explicitly identify them on the page before they can be referenced.

As the dynamic database itself is developed and maintained by the trading center, the promotion data report is uploaded through the dynamic database. Data report implementation based on dynamic library has obvious advantages:

1. Follow the open and close principle: avoid hard-coding data reporting in the ordering page. Completely decoupled from the order page, no matter the developer upgrades, or reported logical updates, they do not affect each other.

2. Use in multiple places instead of one place: the dynamic library of small programs can be seamlessly applied to various matrix apps, and can be open source applied to external host apps later, with very good scalability and compatibility.

3. Excellent maintainability: Because the promotion report is completely separated from the order page, the development does not need to consider business implementation and problems, with good scalability.

However, as the dynamic library is a relatively low-level implementation, as the saying goes, the greater the ability, the greater the responsibility, the dynamic library in the actual development, for performance and security has very high requirements, can not because of the dynamic library loading, and slow down the development of the bill of lading page.

As for the data protocol, although the dynamic library can run independently from the order page, how to design a set of widely used data protocol for the dynamic library and make it have good scalability is a problem. In practice, we realize the closed loop of server generating link + dynamic library parsing connection by reforming the function of mounting link.

See the figure below;

(Figure 9: Closed loop of dynamic library with cargo link)

The mount service provides link generation capabilities for the selection interface, generating specific links for that specific traffic master for different items and carrying extended parameters. These parameters are loaded along with the product page. These parameters do not affect the product page, but are required for dynamic library loading. These parameters contain self-validation mechanisms that will be detected if they are modified arbitrarily. For different merchants and commodities, the ability of personalized promotion data reporting can be realized by setting different parameters in the mount link. For example, for different types of services, the duration of stay on the commodity details page can be different if the promotion link is hit.

Unified format of data protocol, for the subsequent judgment of whether promotion hit is also good, such as the unified use of time window strategy to determine whether the user for traffic main promotion hit, for some businesses, can also jump out of the category of goods, directly determine whether the user hit other effective promotion of the business.

(2) Write optimization based on database batch write

Promotion data reporting has the characteristics of large request volume and relatively simple business, and the demand for real-time query of promotion data is not so strong. In the actual development, we adopt the mechanism of database asynchronous batch write for promotion service to improve performance.

(Figure 10: Batch write write optimization)

Now, the optimization process is illustrated in the figure above. The single write before improvement is actually a straightforward single write. Every time data is reported, the data is written through the control layer, service layer and data persistence layer. The advantages are simple logic, good real-time writing, suitable for general OLTP service. However, for data reporting services (similar services include registration service and log reporting service), there is no need for real-time query. Therefore, when service resources are limited, batch write can be used to make full use of resources and improve service throughput.

The part on the right of the figure is the optimized batch write, which is essentially a producer-consumer model with the goal of reducing the TPS of the database. Each time a report is received, it is added to a blocking queue in memory, changing synchronous write to asynchronous write. The queue performs writes every time, so the database write QPS is actually significantly reduced.

In the transaction center, the db design of horizontal sub-table is generally adopted, and the design of promotion record is the same. The data table is stored in different data tables according to the sub-table field routing, and different tables can be separated into different database instances for further horizontal expansion. The following figure is the data table rules in “Analysis of order System Architecture of Baidu Trading Center”. The classification of promotion records is similar.

(Figure 11: Sub-table rule)

For this kind of database result, in the database batch write, there can be another optimization, that is, the same instance, sub-table records are aggregated, and then unified execution. This can further improve the database write efficiency.

Four,

The difficulty of the construction of commodity promotion system lies in the complex business and long construction path, which requires cross-team and cross-department cooperation.

After the business is sorted out clearly, for the implementation of the technical side, except for the dynamic library, other parts of the implementation complexity is not too high. The key lies in the control of boundary conditions and the control of details. Promotion system and trading center, lucky to stand on the shoulders of giants, riding the wave head, natural twice the result with half the effort.

Historically, software development projects are mostly divided into systems engineers, algorithm engineers and business engineers according to the field of work. No matter what kind of engineer, in order to avoid the mission, they need to accumulate on the breadth and details, so that they can grow thin.

Recruitment information

Baidu mobile ecology division MEG and user center are recruiting r&d positions (PHP/GO/C++). We are mainly responsible for core business directions such as Passport, user assets, attributes, and baidu APP membership, and are committed to creating an efficient, convenient and safe user system. Join us if you are interested in Passport, Mega QPS services, distributed design & Governance.

Baidu Geek, a public account of the same name, said that click the menu bar “push” to join the search architecture department, we look forward to your joining!

Recommended reading:

Baidu search stability analysis of the story (ii)

Baidu search stability analysis of the story (1)

Baidu’s exploration of micro-front-end architecture EMP: Landing production of usable micro-front-end architecture

Community coding to identify black ash production attack practices

———- END ———-

Baidu said Geek

Baidu official technology public number online!

Technical dry goods, industry information, online salon, industry conference

Recruitment information · Internal push information · technical books · Baidu surrounding

Welcome to your attention