According to the opening | mPaaS core components of a service system overview “, we have a preliminary understanding mPaaS platform core architecture of the items constituting the backend system.

Among the mPaaS server components, mobile API gateway MGS is the component product that connects mobile client and server. It simplifies the data protocol and communication protocol of the mobile terminal and the server, so as to significantly improve the development efficiency and network communication efficiency. It is the core entrance of the whole mPaaS service.

Next, we will focus on the introduction of mPaaS MGS to further understand the characteristics of this capability:

Why do I need to move the API gateway

| mobile network access architecture evolution

The traditional single-application architecture is increasingly unable to support the development of multiple teams and businesses in terms of team and business growth. With the popularity of microservice architecture style in recent years, more and more enterprises microservize their own services, and the previous large applications are split into multiple scattered services. At the same time, with the rapid development of new opportunities such as mobile Internet and inclusive finance, companies are increasingly eager to open up existing mature back-end services.

At this time, in the face of the complex mobile network environment, a variety of front-end devices such as Android, iOS, H5, and small programs need to be accessed, and then scattered micro-service systems need to be exported, so it is necessary to have a set of devices that can be applied to the mobile network environment, with high performance, high reliability and easy to use, routing different types of front-end and back-end micro-services. Help each service to provide a unified flow limiting, caching, security, monitoring and other processing mobile API gateway back-end gateway.

mPaaS MGS

| modern mobile network access architecture best practices

MGS, the mobile API gateway on mPaaS, comes from the accumulation of hundred-million-level network service technology of Alipay App for many years. Ant supports hundreds of apps such as Alipay, Koubei, Netbusiness, Jubao and Hong Kong version with tens of thousands of API services, maintaining a high availability rate of 99.9999+% all year round, with sufficient stability.

As a “client-to-server request-response model” service in mobile network technology, it has experienced the test of massive requests for the Double Eleven, double Twelve and Spring Festival red envelope activities for many years. On ant Financial cloud public cloud and private cloud, it also provides high performance, high reliability and mass service support for clients such as 12306, Guangfa Bank and Shanghai Metro.

At the bottom of MGS, Netty is used to realize efficient asynchronous non-blocking service. QPS of 4C8G single machine can reach 10,000 +/s.

The front end supports HTTP/HTTP2 / MMTP protocols, JSON/Protobuf transmission formats, client RPC and H5 standard Rest requests, which can be widely used for various terminal requests.

At the same time, in order to better support the existing business needs of customers on the cloud, MGS backend supports HTTP/Dubbo/SOFA/HRPC/MPC and other heterogeneous backend, which is compatible with the original service of the business to the maximum extent. You can also use the SPI SDK provided by MGS to register with the configuration center directly with annotations on the API function signature, eliminating manual REGISTRATION of the API through service discovery.

MGS also has a simple and easy-to-use Web management and control page, which can easily manage the function configuration of the global App and each API in the tenant. Including __ configuration signature check/result cache/timeout setting/API flow limit/API Mock/API authorization/data encryption/CORS cross-domain/data model/back-end address __, the changed configuration will be asynchronously refreshed to each gateway node in the equipment room after being written to the DB. Ensure that the gateway does not perform additional I/O operations such as DB when processing client requests, further improving the overall performance.

MGS is widely used in public service fields including financial subway. In order to meet the requirements of financial security supervision and ensure the security of user data, the client network SDK adds signatures for each requested data, and then encrypts and transmits the data to the gateway through encryption algorithms such as RSA/ECC/State secret.

The gateway verifies the identity and decrypts the data before forwarding it to the back-end service. After the back-end service processing is complete, the gateway encrypts the data and returns it to the client. Through these measures, let r & D students focus on business and do not worry about network data security.

In the face of a huge number of requests the MGS will pass the result cache, timeouts, API function such as current limiting to help the back-end increase performance, provide overload protection, such as big shortness of peak traffic, business services will still be able to run normally, so as to ensure the stability of the business system, prevent the peak backend server to be overwhelmed.

At the same time, the gateway supports the configuration of a file prompting users on the client during traffic limiting, facilitating product operation and customization.

With the API authorization function, services can be easily customized through MGS, including authorization, Session control and other bypass capabilities. The authorization interface itself is also defined in the form of gateway API, and various configurations such as cache limiting can be set as other apis, so as to unify the service programming model. In addition, the Gateway SPI SDK also supports section interception to facilitate overall expansion within business services.

MGS provides API Mock and API Test for daily development tests.

Through API client code generation (Android/iOS/JS), multiple SDKS are automatically generated to realize the separation of the front and back ends. With THE SDK, business r&d students can focus on business logic without caring about the details of the underlying communication or network experts in the team. They can directly support Fualipay with years of network optimization experience. Free from the complicated mobile network development, maximize the efficiency of business development, so that research and development from now on love API research and development.

Finally, MGS also provides a complete data monitoring and troubleshooting scheme. By generating a unique traceID for each request for link tracing and combining with different types of error codes, the whole link can be connected when problems occur and the problem can be quickly located and the cause can be found.

MPaaS the MGS outlook

| alipay billion level open gateway architecture ability

In addition to the above capabilities, MGS will continue to upgrade, to bring more professional and efficient gateway services for business, including open ABTest gray scale, HTTP2 protocol, mobile scheduling, multi-room live and other functions, with Alipay years of technology accumulation to help upgrade enterprise service technology.

conclusion

Through this section, WE believe that you have a preliminary understanding of mPaaS mobile API Gateway service MGS. For details about gateway functions, see t.cn/EUqYgZC, the official document of the mPaaS Mobile Gateway

We will talk more about the design and optimization of other service components of mPaaS.

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

The opening | ant gold clothes mPaaS core components of a service system overview”

Follow our official account for first-hand mPaaS technology practices