Mobile Sync Service (MSS) is a core basic business component of the mPaaS platform. MSS originates from the E2E solution SYNC of Ant Financial Group, which is oriented to mobile Apps and pushes massive data from the server to the client. This component provides a secure data channel based on the Transmission Control Protocol (TCP) and Secure Sockets Layer (SSL). This data channel can actively synchronize business data from the server to the client App on a timely, accurate, and orderly manner.
Traditional RPC has been applied in the Internet industry for decades and can meet most business scenarios and functional requirements. However, the popularization and development of the mobile Internet have driven the App scale and users’ requirements for Apps to a new stage. Traditional RPC requests have many drawbacks due to their own characteristics.
In certain scenarios, a client needs to call RPC requests to obtain the latest data, but actually no or only little data on the server (cloud) changes.
As different business modules and functions are designed to be independent of each other, they need to call RPC requests respectively to obtain their business data when the client starts.
The client cannot be promptly aware of the data changes on the server but needs to call RPC APIs in polling mode to update data.
Traditional RPC performs data interactions mostly based on HTTP(S) short connections. This type of connection cannot be persistent even if by using features such as keep-alive. In other words, links cannot be reused continuously. Requests for connection creation, certificate exchange, and encryption/decryption will increase the time consumption and compromise the network performance.
MSS is introduced to improve or solve these problems.
The core features of MSS are described as follows:
For business scenarios where the quality of service (QoS) level is arrival guarantee, MSS ensures that the data pushed from your server will be certainly synchronized to the client if the user is active within the data validity period and meets the push requirements of your server.
Orderly and incremental synchronization
MSS ensures that messages transmitted in the same channel arrive at the client in the same sequence as your server calls the MSS server, and all messages are synchronized to the client on an incremental basis.
Highly real-time performance
When the network connection of the client is good, MSS can ensure highly real-time push performance. The time taken for message synchronization almost equals the time taken for pure data transmission over the network (that is, messages can arrive within 1s).
Similar to the binlog mechanism in MySQL, the basic data unit transmitted between the MSS server and the client SDK is oplog. To synchronize a piece of changed data to a specified user or device, your server needs to call the MSS API. Then the MSS server packages the data as an oplog and stores it in the database. When the client is online, the MSS server synchronizes the oplog to the client. Each oplog has a unique ID. Oplog IDs are unique and monotonically increments (based on the call sequence) among certain users and within a certain business scope. The MSS server synchronizes all oplogs to the client in ascending order of oplog ID. Both the MSS server and the client record the largest oplog ID received by the client, which is called the synchronization point (or understood as the data version number).
When the client is successfully initialized, the server can push multiple pieces of business data at a time to reduce the number of requests.
Only incremental data is synchronized, reducing the transmission of redundant data and the network costs.
Data synchronization is not requested when there is no incremental data, reducing redundant requests.
Improved time efficiency
When the server encounters data changes, the changed data is instantly synchronized to the client, without the need to wait for requests from the client.
Data is synchronized imperceptibly and is present before the client UI is rendered, reducing the waiting time of users.
MSS can be applied in business scenarios where data needs to be synchronized in real time to the client, such as transfer result synchronization, payment result synchronization, and message center. You can learn more about MSS capabilities through the following scenarios:
In instant messaging Apps, MSS provides incremental and reliable message delivery capabilities to synchronize chat messages to specified users based on the message sending order of the sender.
In Apps requiring dynamic configuration updates, MSS dynamically synchronizes configuration information to all devices. MSS synchronizes information including the app function switch, dynamic parameters, and dynamic configurations to the specified client in real time, or dynamically modifies the business parameters and configurations in batches when the App is running.
For payment Apps, MSS provides a secure data channel for synchronizing transaction data online, ensuring that the Apps can receive the data in real time when they are online. In addition, MSS provides the data persistence capability. If data is synchronized when an App is offline, the App can receive the data when going online.