mobile wireless networks
Because mobile platform itself , power , network traffic restrictions in the design of mobile Internet applications with the traditional PC applications on a large not the same, the characteristics of the phone itself need to , try to save power and flow , while also timely as possible to ensure data reaches the client .
In order to solve the problem of data synchronization , on mobile platforms , there are two kinds of commonly used methods . One is timed to query the data on the server , also called Polling , there is a phone with the server maintains a TCP connection is when the server has data, real-time push to the client , that is, we said Push .
from consuming electricity , traffic, and timeliness of data delivery terms , Push will have a distinct advantage, but Push the implementation and maintenance costs are relatively high. In mobile wireless networks under maintenance long connection , there are also some relatively technical difficulty . This paper attempts to describe what we aurora push on the Android platform is how to maintain a long connection .
characteristics of mobile wireless networks
IP v4 because the IP is limited, operators assigned to the mobile terminal is the IP carrier network 's IP, mobile phones to connect to Internet, you need to pass the gateway operator to make a network address translation (Network Address Translation, NAT). Simply put, carriers need to maintain an external network gateway IP, port to the internal network IP, port mapping to ensure that mobile phone network can communicate with the Internet server .
NAT functionality is provided by the figure GGSN module.
most mobile wireless network operators are no data communication link for some time , it will eliminate the corresponding entry in the NAT table , causing the link is interrupted .
Android platform to achieve long connection
failure to prevent the NAT table , we need to send regular heartbeat to refresh the NAT entries , to avoid being eliminated.
Android task scheduled to run on common methods are two kinds , a method used Timer , the other is AlarmManager .
Timer
Android Timer class can be used to plan the tasks need to loop , Timer problem is that it needs to use WakeLock CPU keeps awake , it will consume a lot of phone battery , greatly reduce the short standby time . This approach can not meet our needs.
AlarmManager
AlarmManager Android system package for the management of the RTC module , RTC (Real Time Clock) is an independent hardware clock, the CPU Sleep normal operation , the preset time is reached, by interrupt CPU.
This means that if we use AlarmManager to scheduled tasks , CPU can normally sleep , only waking up when the task needs to be run for a very short time. Aurora push Android SDK is based on the implementation of this technology .
server design
When there are a large number of mobile terminals need to maintain a long connection with the server when the server design will be a great challenge.
Suppose a server maintenance 100,000 long connections, when the amount of 10 million users , you need to have as many as 100 servers to maintain the long connection of these users , there also is not used to make the backup server , this will be a huge cost. Then we need to access a single server to maximize the amount of users , that is, the industry has been discussed for a long time the C10K problem .
C2000K
To address this problem, we set up a special project named C2000K, by definition, our goal is to maintain two million single long connection . Ultimately, we adopt a multi- message loop , asynchronous non-blocking model, a dual -core , 24G of memory on the server , to achieve peak maintained over 3 million long connection .
Postscript
stable maintenance of long connection is to push the platform, a foundation , the Aurora team will push long-term investment in this regard , to ensure that users can effectively save power , flow, while the data in real-time delivery.
------ Solution ---------------------------------------- ----
soft soft soft
------ Solution ------------------------------ --------------
learn, thank you for sharing
------ Solution ----------------- ---------------------------
long knowledge , not easy to implement long connection
------ Solution --------------------------------------------
very powerful , support ~
------ Solution - -------------------------------------------
study under the long connection knowledge , thank you for sharing
------ Solution - -------------------------------------------
single concurrent 300W Mody , quite sharp ah
------ Solution ----------------------------------- ---------
support money Kane
------ Solution ------------------------------------ --------
good, or very tricky ah
------ Solution --------------------- -----------------------
powerful insight gained a
------ Solution ------ --------------------------------------
laser push blog on the article. . .
------ Solution ---------------------------------------- ----
can SMS push ah , the terminal only need to register receiver on the line .
------ Solution -------------------- ------------------------
looks and GCM almost right
------ Solution -------- ------------------------------------
Thank landlord ; thank
---- - Solution --------------------------------------------
good good good
------ Solution ------------------------------------- -------
in timely response , while also saving the provincial traffic right
------ Solution ------------------ --------------------------
seemingly very powerful, learn the
------ Solution ---- ----------------------------------------
up knowledge , and long connection is the best solution ah
--- --- Solution --------------------------------------------
there is no tried IPV6 do ?
------ For reference only -------------------------------------- -
------ For reference only ---------------------------------- -----
long connection somewhat obvious
------ For reference only ------------------------- --------------
do push would have to use a long connection
------ For reference only ------------- --------------------------
------ For reference only -------------------- -------------------
long connection is king
------ For reference only ----------- ----------------------------
basically using TCP connection
------ For reference length only ---------------------------------------
learn about
------ For reference only ---------------------------------------
Yes, thanks for sharing
------ For reference only - -------------------------------------
300万two long connections, rather Niu < br> ------ For reference only ---------------------------------------
now C3000K Mody ?
------ For reference only ---------------------------------------
long connection is a basic
------ For reference only ---------------------------------------
tangled andriodpn
------ For reference only ---------------------------------- -----
AlarmManager use very clever
------ For reference only ------------------------- --------------
heartbeat is a very good choice
mobile Internet application status
没有评论:
发表评论