头图

Tencent Advertising (ad.qq.com) is a one-stop advertising platform, sitting on Tencent ecological traffic, with rich and unified advertising capabilities. Advertisers can perform WeChat, QQ, Tencent Alliance, App treasure, and mobile QQ on this platform. Advertising through channels such as browsers.

This article introduces how Tencent Advertising combined with the cloud-native integrated development platform ~ Cloud Development CloudBase, released the "Tencent Advertising Assistant" applet, to achieve the goal of reducing advertisers' tracking costs and improving advertising optimization efficiency.

1. Project background

In order to reduce the cost of advertisers' tracking and improve the efficiency of advertising optimization, Tencent Advertising based on this pain point, with the help of cloud development CloudBase capabilities, released the "Tencent Advertising Assistant" applet, which provides multi-account login and switching functions, and intuitive Data reports, lightweight operations and timely new message reminders create an integrated mobile-end optimization management solution for advertisers and service providers, helping advertisers achieve more efficient and convenient advertising management.

2. Architecture design

1. Business architecture design

“Tencent Advertising Assistant, as a tool for Tencent’s advertising platform, hopes to provide advertisers with the ability to manage ads on mobile devices. Therefore, in the mini-program terminal, we provide advertisers with basic capabilities and high frequency on the PC side. The functions used and the business functions are designed as follows:

2. Technical architecture design

Tencent's advertising service mainly provides services through the open platform MKT API (external) and GDT API (internal). The CloudBase cloud function (Backend For Frontend) layer. The call level is as shown in the figure below. Show:

On the whole, BFF is a layer of API designed to meet specific client scenarios. It can provide multiple back-end microservices to the client to use the processed data through aggregation, tailoring, and orchestration. As for product business The functions, data models, etc. should be implemented in the back-end API instead of being implemented in the BFF.

Before the project was approved, the team compared a variety of small program development frameworks. After comparing performance, development efficiency and stability, the native development framework and cloud development service finally adopted for the following reasons:

  • There are strong performance requirements for small programs. Whether it is a third-party framework compilation or runtime solution, the native small program development model is relatively more suitable in terms of robustness and performance;
  • Our mini terminal does not need to support multiple different mini terminals, and there is no historical code migration baggage, and the cost of using native development and third-party framework development is not much different;
  • For the differences in the development experience between native development and the use of the framework, such as small programs that do not support less, the follow-up uses front-end engineering methods to solve them.

The technology stack currently used is as follows:

Third, the application and practice of cloud development CloudBase

1. Aggregation interface

In the early stage of the development of the mini program, the middle platform service was directly called on the front end of the mini program, and then some problems were encountered. For example, for some pages or functions, it is necessary to call multiple interfaces to obtain the data, and then splice them into the final needs. data. If this logic is done at the front end, then the call link of the entire request will be enlarged. It is a request from multiple clients to the server. If a data request is slow or fails, it will affect the final data. , Which affects the user experience more. And if it is put on the BFF layer, it becomes one client-to-server request and multiple server-to-server requests. The call link is much shorter than the front-end request of the applet, and the stability is better. .

The report data displayed on the "Tencent Advertising Assistant" applet will contain data such as summary, month-on-month, and year-on-year, so it is necessary to combine and call different middle-stage interfaces to obtain the final data. Therefore, the team switched the report-related interface to directly call the cloud function , and the cloud function concurrently called the middle-stage service interface and aggregated the data back to the applet. At the same time, the returned data is returned on demand as required by the small terminal. For example, for the request of the account list page, the original front end needs to perform 3 concurrent requests to obtain the final data, and passes the cloud function, and the applet end only needs to call an interface .

拉取报表数据的云函数运行数据 聚合后云函数接口请求耗时数据

2. Improve the development experience of cloud functions

At present, the official recommendation on CloudBase is to manage public dependency libraries and code issues in layers, but from a development perspective, it is still hoped that the source code can be locally dependent and reduce the introduction of more concepts and operating costs.

Extracting the public code usually requires moving the code to a public directory or publishing it as an npm package. In the cloud function of the applet, each cloud function is an independent directory and there is no public directory. If you use the npm package method, then the cost of debugging, publishing, and updating the version number will be relatively large.

So we extracted the common code into a separate directory in the project, and at the same time, during development and code construction, we used the construction tool to synchronize the common code to the directory of each cloud function in real time.

At the same time, based on the cloudbase-manager-node sdk in the project, the team implemented local template creation, code and configuration updates, and query status of cloud functions to improve the development experience.

View cloud function status:

npm run cf:list

Update the code in real time and deploy to the specified environment:

npm run cf:watch -- --func=getUserInfo,mktapi --env:preview

3. Multi-environment deployment and blue-green release plan

There are currently 5 cloud development environments for "Tencent Advertising Assistant", which correspond to the main environment, backup environment, test environment, R&D environment, and pre-release environment. During development, you can specify which environment to connect to when the code is compiled through the command line, such as :

npm run dev -- --cloudEnv=development

Then our applet will be connected to the development environment of cloud development, and the corresponding environment will be displayed on the floating ball on the applet page.

For the release of cloud functions, a blue-green release strategy is adopted. The main environment and the backup environment are available on the external network at the same time. Whenever it is released, the traffic will be gradually switched from one side to the other. If there is no problem, then gradually the full amount. The general flow is shown in the following figure:

The flow switching logic here can be controlled by the WeChat gray scale strategy when the Mini Program is released, and it can also be controlled by using the feature switch on the Mini Program.

IV. Project summary and results

1. Influence

Since the "Tencent Advertising Assistant" mini program was launched at the end of May 2020, the number of users has continued to rise.

At the same time, it can be seen from the figure below that the small terminal makes up for the scenario where the advertiser is not next to the computer during peak hours and after get off work. With a small terminal, advertisers can manage advertisements at any time.

2. The benefits of using the cloud to develop CloudBase

With the help of cloud development capabilities, the "Tencent Advertising Assistant" applet project has gained many benefits, including:

  • The cloud function provides a private transmission protocol, which provides a guarantee for data transmission;
  • Improve the overall development efficiency, and be able to complete the development of requirements in scenarios with limited labor costs;
  • Through the integration of cloudbase-node-sdk, one-click deployment is realized, and operation and maintenance costs are also eliminated, and there is no need to consider load issues;
  • The cloud development method brings great convenience to joint debugging, and there is no need to configure agents;
  • Cloud development provides a complete ecology and powerful monitoring system.

product description

Cloud Development (Tencent CloudBase, TCB) is a cloud-native integrated development environment and tool platform provided by Tencent Cloud. It provides developers with highly available, automatically and elastically scalable back-end cloud services, including serverless capabilities such as computing, storage, and hosting. , Can be used for cloud integration to develop a variety of end applications (small programs, official accounts, web applications, Flutter clients, etc.) to help developers build and manage back-end services and cloud resources in a unified manner, avoiding cumbersome servers in the application development process With construction and operation and maintenance, developers can focus on the realization of business logic, with lower development thresholds and higher efficiency.
Open cloud development: https://console.cloud.tencent.com/tcb?tdl_anchor=techsite
Product documentation: https://cloud.tencent.com/product/tcb?from=12763
Technical document: https://cloudbase.net?from=10004
Technical exchange group, latest information, follow WeChat public account [Tencent Cloud Development CloudBase]


CloudBase云开发
425 声望438 粉丝

云开发(Tencent CloudBase,TCB)是云端一体化的后端云服务 ,采用 serverless 架构,免去了移动应用构建中繁琐的服务器搭建和运维。同时云开发提供的静态托管、命令行工具(CLI)、Flutter SDK 等能力极大的降...