One article for you to reveal the black technology in the smart air travel service of Shenzhen Airport

One article for you to reveal the black technology in the smart air travel service of Shenzhen Airport

On December 10, during the 2019 Shenzhen Conference of Civil Aviation Smart Airport Construction in Central and South China, Shenzhen Airport and Tencent Cloud created the "Shenzhen Airport" mini program for the first time to showcase its results to the public. As the first domestic airport mini-program that accurately recommends corresponding services based on passengers' flight itineraries, "Shenzhen Airport" covers four types of travel scenarios, including departure, arrival, transfer, and airport pick-up. It provides indoor navigation, transportation, intelligent customer service, 31 sub-services such as baggage tracking provide passengers with scene-based, personalized and intelligent full-process precise services.

What kind of black technology is hidden in this smart airport applet?

1. The whole process, Only OneID

In order to improve the overall service efficiency of Shenzhen Airport, Tencent Cloud has built a set of [OneID full-process passenger travel service system] for Shenzhen Airport. As the name implies, OneID, also a passenger ID, runs through the four major travel scenarios of passengers at the airport, including departure, arrival, transfer, and transfer, and provides 31 sub-services including indoor navigation, traffic travel, intelligent customer service, and baggage tracking.

By adopting the technical means of OneID passenger digital identity, relying on the three terminals of mini program, APP, and official account, the unified entrance provides convenient passenger services throughout the entire process of the airport; various related application systems are opened on the back-end side to unify passenger identity data to realize passengers Behavior tracking, and using big data and AI technology to provide passengers with scene-based, personalized, and intelligent full-process precise services.

In addition, the [OneID full-process passenger travel service system] has established a complete passenger data security guarantee mechanism, providing data encryption, authorization, authentication, auditing, desensitization and other life-cycle security assurance methods; the passenger data system fully complies with GDPR and other data Safety-related industry and international standards and regulations.

▌Overall architecture

2. The efficiency of mini program development and launching has increased by 99%, and the speed of Shenzhen Airport in Shenzhen

▌Fast operation

The fast operation mentioned here refers to the small terminal that can meet the needs of operations and quickly iterate the product form. However, as we all know, the release of the WeChat small program requires the review of the WeChat platform to release the version every time, ranging from 2 hours to long. Ranging from 2 days.

For this reason, the icon interface performance on the entire mini program is basically configurable, such as travel dynamics, services, etc. At present, icon-like services are stored in cloud storage developed by the cloud, the path is stored in the cloud storage, the data is stored in the cloud database, the applet terminal calls the cloud function developed by the cloud, and the cloud function retrieves the data from the database and returns it to the small Terminal, small terminal display, and cache in the local storage.

▌Log system

▌Cloud development

A picture is worth a thousand words. As shown in the picture above, our traditional approach is to build our own ES log system, and then write the client to report the log ourselves. There are many issues involved, such as failure and retry, performance, and the pressure on the current server. All need to be considered. Including the capacity of the ES machine, it is estimated that it will take a week to play a complete set. The applet cloud development provides an advanced log method. You can directly introduce wx-server-sdk into the cloud function, and then directly use the following statement to print error and normal logs.

const objCloud = require('wx-server-sdk');

objCloud.init({env:ENV})
const objLog = objCloud.logger() 
objLog.info({}); objLog.error({});

In this way, error and normal logs can be printed.

The log is sent to the log system developed by the applet cloud, and we can easily search the log according to different conditions in the applet management control panel. Currently, structured query logs are supported. The Shenzhen Airport project currently mainly reports these two types of important logs. One is the log when the applet cloud calls the background interface, and the other is the log when the applet calls the cloud function, which will eventually pass. A cloud function log reports the log to the log system provided by the applet cloud. The log reporting protocol is as follows:

▌2.output/cache

The cache of this project is mainly divided into two parts, one is the client-side cache, and the cache is mainly data for operation and small program interface configuration. These data have a long update cycle and have a large impact. The other is the application layer calling the cloud database cache, which mainly caches data in memory through key and value methods. Each cloud function is fixed to 10 instances in support, and each instance is destroyed when the cloud function is updated, so that the cache becomes invalid, or the cache check code is manually updated on the management side to refresh the cache.

Here are some additional points about the caching strategy and exception design:

  1. Cache expiration: Currently, the cache of the function module is manually updated in the management background, and if the cloud function code is updated, the cache will be updated.            
  2. Cache hit: If the key brought by the client is different from the memory of the current instance, it is considered that there is no hit, and it is directly obtained from the database and a new cache is generated.        
  3. Cache avalanche: Manually update the cache in batches in the background during operation, and reserve 10 instances for each cloud function. To prevent cache avalanches.         
  4. Cache penetration: For the situation where the data has not been found in the database and the cache has been generated and failed, if more than 5 times, the null value will be directly saved to the cache, and the cache generation failure will be reported to the alarm system.            
  5. Cache piercing: For high-concurrency situations, the amount of requests is very large in an instant, the cache misses, and the data pressure is exposed. Record the amount of visits in each time period, and avoid peak visits every time the cache is manually updated. According to the peak concurrency, increase the number of fixed cloud instances reserved.

▌Environment

If the cloud functions developed by the current cloud are synchronized, they will be directly synchronized to the live network, which will affect the function. Therefore, when we develop, we must differentiate the environment to release. Currently we have created three environments for cloud functions: development environment, pre-release environment, and production environment. The pre-release environment and the production environment are consistent, and the connected resources are all real. Only one is for testing and the other is for the majority of live network users. When the applet is running, it will judge the current environment according to the global variable __wxConfig.envVersion , so as to automatically connect to the corresponding applet cloud environment. This avoids changing environment variables all the time, accidentally new developers who join the test environment variables to the production environment, causing accidents.

▌Management side

The management terminal is mainly to realize the management of various operational data, including additions, deletions, revisions, and check. The main logic is to introduce the applet cloud SDK into the management end. Through this SDK, you can quickly and easily query cloud database data and publish cloud resources to the applet cloud. , Modify cloud database data.

The current functions of the management terminal are as follows:

3. summary

The application layer of the entire Shenzhen Airport project is based on the development of the applet cloud. This layer carries the decryption, assembly, monitoring, logging, operation logic, and the business logic for docking with WeChat. Compared with the traditional application layer, it is more responsive. fast.

In addition, with the help of the serverless framework developed by the cloud, there is no need to deploy the application layer and container, and you can directly enter the development, saving operation and maintenance manpower. And built from the log system to obtain user login state, phone number and other scenarios to help businesses significantly improve development efficiency, to get the login state, get the phone number can function, for example reduced from 1 day to 5 minutes . The log system does not need to be built by itself and is ready to use, saving at least 5 man-days.

Currently, our entire project has implemented a total of 25 cloud functions. In the future, we will implement more business cloud functions based on cloud development.

Cloud Development (CloudBase) is a cloud-integrated product solution. It adopts a serverless architecture, avoids operation and maintenance such as environment construction, supports one cloud and multiple terminals, and helps to quickly build small programs, web applications, and mobile applications.

Technical documentation: https://www.cloudbase.net/

WeChat search: Tencent cloud development, get the latest progress of the project

Reference: https://cloud.tencent.com/developer/article/1607525 This article reveals the black technology in Shenzhen Airport Smart Air Travel Service-Cloud + Community-Tencent Cloud