Some thoughts on the principle of Aurora push Technology

Source: Internet
Author: User
Application Status of mobile Internet

Because the mobile phone platform itself, electricity, network traffic restrictions, mobile Internet applications in the design with the traditional PC application is very different, according to the characteristics of the mobile phone itself, as far as possible to save power and flow, but also to ensure that the data can reach the client in time.

In order to solve the problem of data synchronization, there are 2 kinds of methods used in mobile phone platform. One is the time to query the server data, also known as polling, there is a mobile phone with the server to maintain a TCP long connection, when the server has data, real-time push to the client, that is, we say push.

The push will have obvious advantages from the consumption of electricity, traffic and timeliness of data delivery, but the implementation and maintenance costs of push are relatively high. Maintaining long connections under mobile wireless networks is a relatively technical difficulty. This article tries to introduce us to how the Aurora push on the Android platform maintains long connections. features of mobile wireless networks

Because IP v4 IP is limited, the operator assigned to the mobile phone terminal IP is the operator intranet IP, the mobile phone to connect the Internet, you need to do a network address translation via the operator's Gateway (network adress translation,nat). Simply said that the operator's gateway needs to maintain an extranet IP, port to intranet IP, port correspondence, to ensure that the intranet's mobile phone can communicate with the Internet server.

The picture originates from cisco.com.

The NAT function is realized by the GGSN module in the diagram.

Most mobile wireless network operators in the link for a period of time without data communication, will eliminate the corresponding items in the NAT table, resulting in link interruption. implementation of long connection on Android platform

In order not to disable the NAT table, we need a timed heartbeat to refresh the NAT table entries to avoid being eliminated.

There are 2 commonly used methods for running a timer on Android, one using timer and the other is Alarmmanager. Timer

The Android Timer class can be used to plan tasks that need to be cycled, and timer's problem is that it needs to be wakelock to keep the CPU awake, which consumes a lot of cell phone power and dramatically reduces phone standby time. This is not a way to meet our needs. Alarmmanager

Alarmmanager is the module that the Android system encapsulates for managing the RTC, and the RTC (real Time Clock) is a separate hardware clock that works properly when the CPU sleeps and wakes up the CPU by interrupting when it arrives at a preset time.

This means that if we use Alarmmanager to perform tasks on a regular basis, the CPU can hibernate properly and only wake up for a short time when a task needs to be run. The Aurora-pushed Android SDK is based on this technology. Server Design

When a large number of mobile terminals need to maintain a long connection with the server, the design of the server will be a big challenge.

Assuming that a server maintains 100,000 long connections, and when there are 10 million users, up to 100 servers are required to maintain long connections for these users, and this is not a server for backup, which would be a huge cost problem. That requires us to maximize the amount of access to a single server, that is, the industry has been discussed for a long time c10k problem. c2000k

To solve this problem, we set up a special project, named c2000k, as the name suggests, our goal is to maintain 2 million long connection. Finally, we adopted a multi-message loop, asynchronous Non-blocking model, in a dual-core, 24G memory server, to achieve peak maintenance over 3 million long connections. PostScript

Stable maintenance long connection is the basis of push platform, Aurora push team will be in this aspect of long-term investment to ensure that users can effectively save electricity, flow, and data can be delivered in real time.

These are the official articles of the Aurora Borealis, but there are a few questions after reading them.


1 They claim the highest peak value can reach a long connection of 300W, but the most active link processing is how much.

2 The average length and limit of the message.

3 The timeliness of the message, how much delay is.

4) Do not know now, Aurora pushed the user probably how much, so this peak is in the production environment, or test the environment value.

5 I think that is why the client should use Alarmmanager to do the push message acquisition. Did you get the news in time? I know Android also has n load.

6 I am interested in is not the Aurora program one months to push millions of data, but a few seconds or a minute can handle how much.


From: http://blog.csdn.net/androidzhaoxiaogang/article/details/8227469

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.