MPaaS is a mobile development platform derived from Alipay client App, providing enterprises with cloud-to-end one-stop solutions for mobile development, testing, operation and operation maintenance. MPaaS can effectively reduce the technical threshold, reduce research and development costs, improve development efficiency, and help enterprises quickly build stable and high-quality mobile client apps.

After “mPaaS Client Architecture Analysis” series, we have had a preliminary understanding of mPaaS product matrix and specific positioning. From the beginning of this chapter, we will sort out and discuss the mPaaS server core component system, and lead you to further understand the pits stepped in the process of mPaaS server component system construction and the corresponding practical experience.

MPaaS provides three development frameworks for the end: Native development framework, H5 development framework and small program development framework, which contains more than 20 functional components and more than 100 UI controls. Since it is defined as a mobile RESEARCH and development platform, it naturally needs solid mid-stage capability to support the entire client production and operation process. This paper aims to introduce the core architecture system of back-end components of mPaaS platform. . First, let’s take a look at the overall architecture diagram of the mPaaS backend:

As shown in the figure, mPaaS is positioned as mobile PaaS platform, and below it is ant Financial Cloud base, which contains stable hardware environment and can rapidly deploy network, storage, database and other services. On this environment, financial cloud is equipped with distributed financial level database, file storage, cache service, registry, configuration center, message center, scheduling center, monitoring center, big data platform and other basic services, and also deployed with users, permissions, release and other central services required for daily operation and maintenance. MPaaS focuses on providing functional components required by the mobile end. Its core is the mAppCenter console and five functional components:

I. Mobile Gateway (MGS) :

MGS is a component product that connects RPC interfaces of clients and servers. It simplifies the data protocol and communication protocol of RPC interfaces, and significantly improves the development efficiency and network communication efficiency.

The MGS is accord with the framework of the open closed principle gateway, support for multiple client communication protocol: HTTP/HTTPS/http2 / spdy MMTP (ant mobile communication protocol), can easily fit a variety of terminal applications, support for multiple data serialization methods: Json, Protobuf. In addition, it has a unified and standard API interface control platform and standardized DevOps capabilities:

On the management and control platform, RPC interface management (add, delete, modify, up and down) can be carried out conveniently and quickly. After configuration, APITest can be carried out in real time to verify whether the interface can run as expected. Then, client model code can be generated quickly, supporting code generation of Android, iOS, JS and other languages. For RPC interface MGS can check the request from client to mobile gateway to verify the identity of caller and ensure security.

MGS is confident enough to support a wide range of enterprise-level required gateway platforms:

  1. The core functions and architecture are consistent with the production environment gateway of Alipay client, maintaining a high availability rate of 99.9999+% all year round, with sufficient stability.
  2. Support alipay client, reputation, online business, Jubao, Hong Kong version and other apps, hundreds of millions of daily activities, after years of double 11, double 12, The Spring Festival red envelope activities of the massive request test, 4C8G single QPS can support 10000+/S, with super single performance.
  3. Simple configuration can adapt to multiple terminals and connect to heterogeneous back-end services.
  4. Automatic generation of multi-terminal SDK to achieve front-end and back-end separation, very effective improvement of development efficiency.
  5. Supports registration, discovery, and management of mobile services, and implements service aggregation and integration, greatly reducing management costs and security risks.
  6. The optimized data protocol and communication protocol greatly improve the quality and efficiency of network communication.
  7. With routing, flow control, security, ETAG, customized response and other functions. It can limit the access to API to avoid the background server being overwhelmed during peak hours. Mock API return values to provide specific response results and reduce calls to back-end systems; Before routing a client request to the back-end service system, verify the validity of the request and permit the request only after it passes the verification. The request from the client to the mobile gateway can be encrypted to ensure the security of data in the process of transmission. Currently, ECC, RSA, and National Secret encryption algorithms are supported. And provides error code customization service, can be customized to return the prompt content;

Message Push (MPS) :

MPS provides professional mobile message push solutions. It introduces a variety of push types for different scenarios to meet users’ personalized push requirements. It integrates push functions from apple, Huawei, Xiaomi, FCM and other manufacturers. Users can quickly integrate the mobile terminal push function and maintain interaction with users, effectively improving user retention and user experience.

The core functions of MPS are as follows:

  1. Multiple push methods: can accurately push messages to user-defined target user groups, single user/device, all users and other ways. Push can be triggered from the console page, or through the business system call API interface push;
  2. Custom validity period: The device is not online when the message is sent for the first time. Within the validity period of the message, the device can set up a link or initiate user binding to trigger the message push again, ensuring the message arrival rate.
  3. Personalized template: Provides template management functions for users to configure personalized templates and support users’ personalized push requirements.
  4. Voice broadcast: You can configure a voice template based on service scenarios. After receiving a notification, the client can raise the user’s awareness and click rate of the message by voice.
  5. Push configuration: Configures certificates, supports users to enable push from third-party channels such as Huawei, Xiaomi, Meizu and FCM, and supports input of configuration information.
  6. Key configuration: A key configuration interface is provided for users to configure their own keys. External interfaces need to sign requests to ensure user security. In addition, the message receipt function is provided for users to track the delivery results of messages. MPS also to pay treasure, word of mouth and other client double tenth, 12-12, red packets for Chinese New Year and other activities to provide strong support, can provide a second level under the equivalent size pen push ability, message issued by speed, stable to the client, concurrency support every day hundreds of millions of the number of connections, and their access to low cost, can efficiently provide service for various business scenarios.

Iii. MSS:

Through a secure data channel TCP+SSL, the server’s business data can be synchronized to the client App in a timely, accurate and orderly manner. It is a message-oriented middleware between client and server.

The problems solved by MSS are as follows:

  1. The client needs to repeatedly call RPC on the function page to obtain the latest data, but only a small amount of data changes or even no data changes.
  2. When the service data changes on the server, the client cannot sense the changes in time and can only refresh the data by polling the RPC interface periodically.
  3. In a service scenario where no service is available, clients need to invoke different RPC requests to update data of different services.

MSS defines an Oplog concept by learning the binlog principle of MySQL database. The minimum data unit passed between server and client SDK is called an Oplog. Whenever the business needs to synchronize a data change to a specified user/device, The service invokes the syndData interface of the MSS server, and MSS will package the data changes that the service needs to synchronize as an Oplog persistent to the database, and then push the Oplog to the client when the client is online. If it is currently, push will be triggered immediately. Each Oplog has a unique Oplog ID, which is guaranteed to be unique and monotonically increasing within a certain range of users and services (in order of invocation). MSS pushes each Oplog to the client in ascending order of Oplog ids. Through the ACK mechanism, the server and client record the maximum Oplog ID (also known as the data version) of the synchronized data on the client, and perform differential calculation and synchronization when new data is generated.

MSS has a variety of push features to choose from:

1. Specify or global

  • Specify: push to a specific user (or device);
  • Global: push data to all users (or devices);

2. Users or devices

  • User: corresponds to an account that logs in to the client and is synchronized using the UserID.
  • Device user: corresponds to a client terminal device, which is synchronized through Utdid(generated by the client SDK).

3. Single device or Multiple Devices Suppose that A user has two devices A and B, then:

  • Single-device synchronization: If A piece of data has been synchronized to device A, device B will not receive the data.
  • Multi-device synchronization: Even if A piece of data has been synchronized to device A, it will also be synchronized to device B.

4. Persistent or non-persistent

  • Persistent: Disordered. Data does not fall into the database. When services are invoked, the client is immediately synchronized if it is online, and discarded if it is not.
  • Nonpersistent: Data is stored in the inventory table to ensure that the database sequence has been synchronized to the client. If the database is online, differential calculation and synchronization will be triggered immediately. If the database is not online, synchronization will be triggered after the client goes online.

MSS has covered all client apps and nearly 400 business scenarios in Ant, and tens of billions of them are synchronized to various clients every day. It also supports activities such as “Double 11”, “Double 12” and “Red envelope Promotion” during the Spring Festival for many years, with a continuous availability rate of 99.9999+%. It takes only milliseconds for each packet to be synchronized to the client, which has become an indispensable advanced component of the current super App.

4. Mobile Distribution (MDS) :

The MDS provides client version upgrade packages, hot repair packages, H5 offline packages, small program installation packages, resource packages, configuration item management, and release services.

The MDS publishing service supports grayscale publishing by specific user groups through whitelist configuration management. Advanced filtering rules can be used, such as specifying model, network, region, and grayscale for grayscale publishing in more dimensions. Time Windows can also be set during the publishing process. The release process can be terminated and rolled back to the last stable release at any time; To reduce data redundancy and device bandwidth, MDS provides incremental differential offline package update capability. MDS can provide efficient upgrade service even when mobile network conditions are unstable. At the same time, to ensure security, the hotfix package has a self-defined validation process to ensure the correctness of script sources. The IDE development plug-in of mPaaS also provides the function of generating hotfix resource packages and signing the packages. In addition, MDS also has the ability of compiling, building and packaging the client installation package based on mPaaS framework. Users can host the client code on GitLab of fintech to complete the code management, and then complete the total online through a set of development and release processes such as certificate management, build packaging and real-time release.

V. Movement Analysis (MAS) :

MAS by mobile client, H5, small program multiterminal buried point data collection and analysis, from the terminal type, terminal version, geographical, network type, vendor, model and multiple dimensions shown to realize the core indicators of product monitoring and analysis of mobile application data, can help enterprises to better complete the business monitoring, insight and user behavior analysis, to guide the product iterations, Fine product operation, assist marketing decision, accelerate business commercialization. MAS provides the following functions:

1. Basic analysis:

Focus on general analysis of App, including basic analysis of daily login users, new users, usage duration, user retention, page analysis, access path and so on.

2. Higher-order analysis:

Provide a flexible multidimensional analysis capability for specific analysis needs of App focused business; Provides hot repair reports to help you learn about RPC, repair, and rollback information.

3. Performance analysis

Provides statistics functions of flash back, stuck, and stuck. When a client has a performance problem, the mobile analysis service provides real-time performance analysis statistics.

4. Log Management:

Supports real-time search and query logs by keyword. Combined with MPS/MSS, the dynamic push command enables the client to upload complete log files in real time for analyzing and locating the running status of the client. In addition, you can use the server switch to control the client log reporting logic in real time.

Data link (see figure below) :

After the log file is collected by the client log module SDK, the log content is output to the server log file through the mPaaS log gateway (MDAP), and then the server log reading tool and message middleware are used to deliver the log data to two data platforms (real-time computing platform and offline big data platform).

The core component of the real-time computing platform is Jstorm. Jstorm is a system similar to HadoopMapReduce developed by Aliyun. The developer wrote the calculation topology of Jstorm, which can process the log files that cannot be processed. The client log data can be calculated, stored and displayed within minutes. At present, the data of basic market, custom analysis, log playback and other functions in MAS are calculated and produced by JStorm.

Offline big data platform:

At present, odPS or Spark of Aliyun is mainly used to complete the task (choose according to the actual deployment environment). The development of this platform can complete the calculation of super-large scale data by writing SQL scripts and configuring scheduled scheduling tasks. The user behavior analysis, flow analysis, page funnel analysis and other functions of MAS are calculated and produced by this platform.

Enterprises on the basis of data applications, which can be combined with large data, marketing platform and push platform, according to the movement analysis of buried point data, marking, circle of people through the big data platform, user portrait and modeling, can launch a marketing campaign on marketing platform, specify the type of the activity, the activity algorithm, to participate in the activities of the crowd and prizes, Through message push, data synchronization, dynamic release and other forms, the client can be touched to achieve the purpose of pulling new activities, promoting activities and guiding operations. At the same time, a complete set of digital operation system is formed in combination with the scene requirements of operation activities to monitor the number of participants in an operation activity, activity distribution rate, cancellation rate, etc., and observe the effectiveness of the activity

Earlier, McKinsey released a report saying that in the Internet era, as China’s economic growth has entered a new normal, the operating environment for traditional enterprises has become increasingly severe, and a large number of fintech companies are threatening the core business of traditional financial enterprises in various segments. Traditional financial enterprises are facing unprecedented opportunities and challenges, and digital transformation is imminent. In this context, Ant Financial mPaaS is the right way for all organizations to carry out their own digital transformation.

Through this section, we have a preliminary understanding of how Alipay builds its component system on the server side, and gradually refine and precipitate corresponding capabilities for external output in this process. Later, we will carry out detailed discussions on specific component design and optimization.

Corresponding technical kernel, we also applied in mPaaS and external output, welcome to start the experience: t.cn/ELBlvEr

We also look forward to your feedback on the specific thinking and practice of server component design. Welcome to discuss and communicate with us.

Past reading

Analysis of Alipay App Construction Optimization: Optimizing Android Startup Performance through Package Rearrangement

“Alipay App construction optimization analysis: Android Package size extreme compression”

Brief Analysis of Alipay Small Program Framework and How to Deeply integrate in mPaaS

Follow our official account for first-hand mPaaS technology practices