计算机 / 读书笔记 · 2021年12月19日 0

HPBN读书笔记之Wireless Networks

Chapter 5 Introduction to Wireless Networks

无线网络的类型(按距离划分):

TypeRangeApplicationsStandards
Personal area network(PAN)Within reach of personCable replacement for peripheralsBluetooth, ZigBee, NFC
Local area network(LAN)Within a building or campusWireless extension of wired networkIEEE 802.11(WiFi)
Metropolitan area network(MAN)Within a cityWireless inter-network connectivityIEEE 802.15(WiMAX)
Wide area network(WAN)WorldwideWireless network accessCellular(UMTS, LTE, etc)

计算信道容量的公式(不明觉厉):

\( C=BW \times \log{2}{(1+\frac{S}{N})} \)

  • C is the channel capacity and is measured in bits persecond
  • BW is the available bandwidth, and is measured in hertz
  • S is signal and N is noise, and they are measured in watts

对于上述公式中几个变量的进一步解释:

  • Bandwidth
    无线网络通过电磁波通信,通信者需要在通信前约定好通信的频率,比如802.11b和802.11g标准使用2.4-2.GHz频段。美国联邦通信委员会(Federal Communications Commission, FCC)负责划分各频段的用途。如上面的香农公式所示,通信频段的带宽(bandwidth)与信道传输速率成正比关系,802.11n就是通过将信道带宽从20 MHz提升到40 MHz把数据传输速率加倍。
    不同频率的无线电信号有着不同的特性,低频率无线电信号传播更远,但是需要更大的天线(来产生低频率无线电波),而且(由于传输范围更远)不同通信者之间相互干扰的概率加大。高频率无线电信号就正好相反。
    下图显示了FCC划定的2300-3000MHz无线电波的用途:

    不同国家对无线电频率用途划分可能不同,但是ISM(industrial, scientific, and medical)频段是国际通用的,于1947年通过International Telecommunications Conference确定,WiFi使用的频段就是ISM频段的一部分。ISM频段是任何人可以自由使用的,只要遵循一些技术限制(比如发射功率的限制)。
  • Signal Power
    想要提高信噪比,那么要么提高发射功率,要么减小通信者之间的距离,或者减少使用通频段无线电通信的用户数。
  • Modulation
    频段带宽和信噪比是信道容量的两个主要物理影响因素,但是通信者之间的编码传输信号的算法也对信道容量起着重要影响作用。
    比如:
    • 电磁波信号的发送方和接收方每秒可以处理1000次电磁脉冲信号(modulation alphabets, baud);
    • 每个电磁脉冲信号代表一个2位的alphabet;
    • 那么这个信道的容量就是1000x2bits每秒,即2000bps; 想提高每个电磁脉冲信号alphabet代表的信息量,需要更高级的设备,但也会导致对噪音的抗干扰能力变弱。

Measuring Real-World Wireless Performance

影响你正在使用的无线网络性能的一些因素:

  • Amount of distance between receiver and sender
  • Amount of background noise in current location
  • Amount of interference from users in the same network(intra-cell)
  • Amount of interference from users in other, nearby networks(inter-cell)
  • Amount of available transmit power, both at receiver and sender
  • Amount of processing power and the choosen modulation scheme

Chapter 6 WiFi

From Ethernet to a Wireless LAN

802.11的ISO七层模型示意图:

以太网和Wifi对通信者和通信时机的调度

以太网协议和Wifi协议都将传输媒介当作random access channel,即没有一个中心来调度控制每时每刻哪个通信者可以在这个共享的传输介质上传输数据。以太网使用了CSMA(a probabilistic carrier sense multiple access)协议来调度每时每刻由网络中的哪一个设备来传输数据,简言之就是”listen before you speak”:

  • Check whether anyone else is transmitting
  • if the channel is busy, listen until it is free
  • When the channel is free, transmit data immediately

由于信号传输需要时间,所以仍然存在多个通信者同时传输数据发送collision的情况,所以以太网也引入了collision detection(CSMA/CD),当collision发生的时候,同时传输数据的通信者都立即停止传输,随机等待一段时间(结合指数回退的策略)再发送数据。
WiFi网络类似,但是WiFi做不了collision detection,只能搞collision avoidance(CSMA/CA)。WiFi中的通信设备每次发送一帧,收到其ack之后才会继续发送下一帧。

In practice, the probabilistic access model works very well for lightly loaded networks. In fact, we won’t show the math here, but we can prove that to get good channel utilization (minimize number of collisions), the channel load must be kept below 10%. If the load is kept low, we can get good throughput without any explicit coordination or scheduling. However, if the load increases, then the number of collisions will quickly rise, leading to unstable performance of the entire network.

WiFi标准及其特性

802.11 protocolReleaseFreq(GHz)Bandwidth(MHz)Data rate per streamMAX MIMO streams
bSep 19992.4201,2,5.5,111
gJun 20032.4206,9,12,18,24,36,48,541
nOct 20092.4207.2,14.4,21.7,28.9,43.3,57.8,65,72.24
nOct 200954015,30,45,60,90,120,135,1504
ac~2014520,40,80,160up to 866.78

WiFi的发射功率被限制在200mW。
所以想要提高WiFi网络的性能:

  • 使用频段带宽更大的信道(n,ac两个标准将信道带宽从20MHz提升到了40MHz)
  • 使用更nb的modulation(让发送的每个信号携带更多的信息)
  • 同时使用多个流(MIMO,貌似需要WiFi有多个天线同时在多个信道进行通信才可以)
    上面这些都做到了,那么将可以获得Gbps级别的无线网络传输速率。

Measuring and Optimizing WiFi Performance

下面的两张图显示了某个办公环境或者都市环境下的wifi扫描结果和wifi通信的频段。使用同一频段通信的wifi之间互互相干扰。

在Android上可以使用WiFi Analyzer之类的应用获取这种信息;而在Linux上,可以通过执行nmcli d wifi获取这些信息(nmcli看起来也是一个很有趣的命令)。

  • WiFi下的丢包
    虽然WiFi的CSMA/CA策略在信道拥挤的时候会造成较多的collision,但是这并不意味着WiFi下的TCP传输一定会表现出更高的丢包率,因为WiFi下的数据链路层和物理层有自己的重传机制和error correction机制。
  • WiFi下的latency
    同上述理由,WiFi下的latency(尤其是用户到ap的这一跳)是容易因为信道的状况发生变化的,可以观察到long latency tail。那么BBR能正确处理WiFi的这种variable latency特性吗?BBR不是将latency当作整个链路中路由里的缓存队列长度的表现吗?
  • WiFi下的带宽
    仍然同上述理由,WiFi下的带宽(用户到ap的带宽)也是在不断发生变化的。不过在跨越整个互联网的传输过程中,这个带宽应该不至于成为链路的瓶颈带宽吧?

Chapter 7 Mobile Networks

Brief Historynof the G’s

GenerationPeak data rateDescription
1Gno dataAnalog systems
2GKbit/sFirst digital systems as overlays or parallel to analog systems
3GMbit/sDedicated digital networks deployed in parallel to analog systems
4GGbit/sDigital and packet-only networks
GenerationData rateLatency
2G100-400Kbit/s300-1000ms
3G0.5-5Mbit/s100-500ms
4G1-50Mbit/s<100ms

First Data Services with 2G

1979年第一个商用1G网络诞生于日本,这是一个没有数据传输能力的模拟系统(analog system)。1991年第一个2G网络在芬兰诞生,基于GSM(Global System for Mobile Communications, originally Groupe Special Mobile)标准,并且在无线电网络中引入了电子信号。该网络第一次提供了基于circuit-switched的移动数据服务,比如短信(SMS),传输数据的速率最高为9.6Kbit/s。
1990年代中期,GPRS(General Packet Radio Service)被引入GSM标准,最高可以提供172Kbit/s的传输速率,伴随着几百ms的rtt。GPRS和2G语音通信网络合在一起被称为2.5G。2003年在美国则诞生了第一个EDGE(Enhanced Data rates for GSM Evolution)网络,称为2.75G,可以提供达384Kbit/s的数据传输速率。

3GPP and 3GPP2 Partnerships

2G有两个标准,一个是ETSI(European Telecommunication Standards Institute)制定,一个是高通制定(IS-95标准),前者占80%-85%市场份额,后者则占了10%-15%份额,并且主要是占领了美国市场。这两个标准不兼容,并且由这两个标准出发,分别诞生了两个不同的组织来制定更新的网络通信标准。
下图是各种通信技术的市场份额变化情况:

  • 3rd Generation Partnership Project(3GPP)Responsible for developing the Universal Mobile Telecommunication System(UMTS), which is the 3G upgrade to GSM networks. Later, it also assumed maintenance of the GSM standard and development of the new LTE standards.
  • 3rd Generation Partnership Project2(3GPP2)Responsible for developing the 3G specifications based on the CDMA2000 technology, which is a successor to the IS-95 standard developed by Qualcomm.
GenerationOrganizationRelease
2G3GPPGSM
2G3GPP2IS-95(cdmaOne)
2.5G,2.75G3GPPGPRS,EDGE(EGPRS)
2.5G,2.75G3GPP2CDMA2000
3G3GPPUMTS
3G3GPP2CDMA2000 1x EV-DO Release 0
3G,3.75G,3.9G3GPPHSPA,HSPA+,LTE
3G,3.75G,3.9G3GPP2EV-DO Revision A, EV-DO Revision B, EV-DO Advanced
4G3GPPLTE-Advanced, HSPA+ Revision 11+

HSPA(High Speed Packet Access network)是指同时支持HSDPA(High Speed Downlink Packet Access)和HSUPA(High Speed Uplink Packet Access)的网络,通常称之为3.5G,可以提供上Mbit/s的速率。HSPA+则被称之为3.75G。

在移动无线工业界:

  • There are two dominant, deployed mobile network types around the world
  • 3GPP and 3GPP2 manage the evolution of each technology
  • 3GPP and 3GPP2 standards are not device interoperable

不存在单一的4G或3G技术,ITU(International Telecommunication Union)只为每一代无线通信技术设定性能上需要满足的要求,而3GPP和3GPP2两个组则根据他们各自的技术去制定具体的标准。
使用了SIM卡的手机是在使用GSM演化而来的由3GPP制定的技术。

Evolution of 3G Technologies

3G技术有两个主流的标准,由3GPP发展的UMTS和由3GPP2发展的基于CDMA的网络。

Evolution of 3GPP technologies

ReleaseDateSummary
991999First release of the UMTS standard
42001Introduced an all-IP core network
52002Introduced High-Speed Packet Downlink Access(HSDPA)
62004Introduced High-Speed Packet Uplink Access(HSUPA)
72007Introduced High-Speed Packet Access Evolution(HSPA+)
82008Introduced new LTE System Architecture Evolution(SAE)
92009Improvements to SAE and WiMAX interoperability
102010Introduced 4G LTE-Advanced architecture

Evolution of 3GPP2 technologies

CDMA2000 EV-DO标准的发展历程:

ReleaseDateSummary
Rel.01999First release of the 1x EV-DO standard
Rel.A2001Upgrade to peak data-rate, lower latency, and QoS
Rel.B2004Introduced multicarrier capabilities to Rev.A
Rel.C2007Improved core network efficiency and performance

3GPP2没有相应的4G标准,因为最后全球的运营商都同意将3GPP LTE标准作为所有网络要采用的4G标准。换句话说,运营商都逐渐收敛到HSPA+和LTE这两个无线网络标准了。

IMT-Advanced 4G Requirements

和3G一样,4G也不是一种单一的技术,只要满足ITU于2008年发布的IMT-Advanced 4G标准的技术就是4G。这个标准的一些要求如下:

  • Based on an IP packet switched network
  • Interoperable with previous wireless standards(3G and 2G)
  • 100Mbit/s data rate for mobile clients and Gbit/s+ when staionary
  • Sub 100 ms control-plane latency and sub 10 ms user-plane latency
  • Dynamic allocation and sharing of network resources between users
  • Use of variable bandwidth allocation, from 5 to 20 MHz

LTE-Advanced 是专门发展出来满足IMT-Advanced 4G要求的技术,也是3GPP的第一个满足4G标准的技术。LTE(release 8)和LTE-Advanced(release 10)技术虽然名字看起来很像,但实际上是不同的技术,LTE(release 8)仍然是3G,或者可以称为向4G过渡的3.9G技术。LTE和HSPA+技术也常被称为“4G”技术,这是运营商在市场营销上的胜利(这两个技术也确实很接近4G)。

Long Term Evolution(LTE)

  • All IP core netwrok
  • Simplified network architecture to lower costs
  • Low latencies in user(<10ms) and control planes(<100ms)
  • New radio interface and modulation for high throughput(100Mbps)
  • Ability to use larger bandwidth allocations and carrier aggregation
  • MIMO as a requirement for all devices

LTE网络的部署并不是对3G网络基础设施升级这么简单,而是需要部署和现有3G基础设施并存的新的基础设施,并且需要和现有3G网络工作在不同的频段上。LTE作为UMTS和CDMA两种标准的共同继任者,提供了用户在3G网络和LTE之间来回切换的能力。
LTE的部署是一个漫长的过程,因为需要全新的基础设施上的投入。
对于支持LTE的设备,要实现MIMO,就必须得有多个天线;2G,3G和LTE也需要不同的天线,所以手机如果支持MIMO的话,那么手机上就可能有至少4个天线。关于MIMO的简单介绍。除了屏幕,处于active状态的手机天线是第二耗电大户。

HSPA+ is Leading Worldwide 4G Adoption

由于LTE需要全新的基础设施,对于运营商来说需要的投入很大。于是在原有3G网络上进行升级的HSPA+技术也成为了主流之一。各种网络技术的变化趋势是:基于CMDA的逐渐减少;HSPA+成为一段时间的主流;LTE则是随着运营商对网络基础设施的投入也逐渐成为主流,最终超过HSPA+。

Building for the Multigeneration Future

虽然4G网络(包含LTE)在传输IP数据包方面有了大的提升,但是讽刺的是3G网络却比4G更善于传递语音通信的数据。

HSPA+LTELTE-Advanced
Peak downlink speed(Mbit/s)1683003000
Peak uplink speed(Mbit/s)22751500
Maximum MIMO streams248
Idle to connected latency(ms)<100<100<50
Dormant to active latency(ms)<50<50<10
User-plane one-way latency(ms)<10<5<5

User-Plane One-Way Latency

User-plane one-way latency is the target time specified by the LTE standard for the one-way transit between a packet being available in the wireless device and the same packet being available at the radio tower. In other words, it is the one-way latency of the first wirelss hop when the device is in the high-power continuous reception state. Every application packet will incur this cost-no shortcuts.

就是一个数据包从移动设备(设备处于正常耗电状况下)到第一个基站需要的时间。

Device Features and Capabilities

User Equipment Category

Sample 3GPP HSPA user Equipment(UE) categories:

3GPP ReleaseCategoryMIMO, MulticellPeak data rate(Mbit/s)
587.2
51014.0
71421.1
8202x MIMO42.2
821Dual-cell23.4
824Dual-cell42.2
1032Quad-cell + MIMO168.8

LTE user equipment(UE) categories:

3GPP releaseCategoryMIMOPeak downlink(Mbit/s)Peak uplink(Mbit/s)
811x10.35.2
822x51.025.5
832x102.051.0
842x150.851.0
854x299.675.4
1062x or 4x301.551.0
1072x or 4x301.5102.0
1088x2998.61497.8

想要你的手机获得好的网络性能,那么需要手机设备的UE版本和所使用的网络版本相匹配,且都是高版本才行。

Radio Resource Controller(RRC)

Radio Resource Controller: 

3G,4G, and WiFi Power Requierments

对于使用WiFi的移动设备来说,天线的功率由设备自己决定,通常在30-200mW这个范围;而使用3G/4G的设备,天线的功率则由基站网络来决定,在idle状态下的设备天线,其功率可以低至15mW,但是在high-power状态下,其功率也可以达到1000-3500mW。
在传输大量数据的时候,如果信号好,WiFi更节能,但是如果设备大多数时候处于空闲状态,那么3G/4G天线更节能。可是现在并没有可以在两种网络下自由切换以达到节能目的的机制存在。

LTE RRC State Machine

LTE RRC State Machine: 
每一个LTE设备的天线状态由服务该设备的基站控制。

  • RRC Idle
    Device radio is in a low-power state(<15mW) and only listening to control traffic. No radio resources are assigned to the client within the carrier network.
  • RRC Connected
    Device radio is in a high-power state(1000-3500mW) while it either transmits data or waits for data, and dedicated radio resources are allocated by the radio network.

设备处于IDLE状态时,是不能传输数据的,想要传输数据需要和基站通信变为Connected状态,而这个过程在3GPP LTE网络中需要最多100ms,在LTE-Advanced网络中需要最多50ms。

  • Continuous reception
    Highest power state, established network context, allocated network resources
  • Short Discoutinuous Reception(Short DRX)
    Established network context, no allocated network resources
  • Long Discontinuous Reception(Long DRX)
    Established network context, no allocated network resouces

Discontinuous Reception: 

LTELTE-Advanced
Idle to connected latency<100ms<50ms
DRX to connected latency<50ms<50ms
User-plane one-way latency<5ms<5ms

HSPA and HSPA+(UMTS)RRC State Machine

LTE之前的HSPA和HSPA+网络的RRC状态机更加复杂,因为更复杂所以也间接导致了更高的延时。
HSPA和HSPA+的RRC状态机: 

  • Idle
    Similar to idle in LTE. The device radio is in a low-power state and only listening to control traffic from the network. No radio resources are assigned to the client within the carrier network.
  • Cell DCH
    Similar to connected LTE mode when in continuous reception. The device is in a high-power state, and network resources are assigned both for upstream and downstream data transfer.
  • Cell FACH
    An intermediate power state, which consumes significantly less power then DCH. The device does not have dedicated network resources but is nonetheless able to transmit small amounts of user data through a shared low-speed channel(with speeds of typically less than 20Kbps)

FACH状态下,设备仍然可以以一个较低的稳定的速率传输数据。

从DCH到FACH的状态转换是靠的timer,而从FACH到DCH的状态转换则是在设备中buffer中要发送的数据达到某个阈值之后触发。
LTE虽然提供的中间状态比HSPA,HSPA+多,但是由于LTE提供的数据传输速率更高,所以LTE的能耗仍然更高。

EV-DO(CDMA) RRC State Machine

CDMA RRC状态机:

  • Idle
    Similar to idle in 3GPP standards. The device radio is in a low-power state and only listening to control traffic from the network. No radio resources are assigned to the client within the carrier network.
  • Connected
    Similar to connected LTE mode and DCH in HSPA. The device is in a high-power state and network resources are assigned for both upstream and downstream data transfers.

Inefficiency of Periodic Transfers

一种耗电并且用户体验糟糕的传输数据的模式:

根据ATT实验室的研究,46%的天线消耗的电量只用来传输了0.2%的数据。

End-to-End Carrier Architecture

下面介绍了一个LTE网络的典型构成:

Radio Access Network(RAN)

 eNodeB就是基站了,也是Radio Resource Controller。当用户从一个邻近基站收到了更强的信号或者用户当前所连接的基站过载时,用户就可能被切换到另一个基站。这个切换的过程很复杂,在LTE网络中这个过程可能需要几百毫秒,而在更早的网络中这个过程可能需要长达几秒。这个切换过程也会造成数据传输的停滞,会被应用程序和用户感知。 在基站密度大的地区(城区、办公区),用户可能会来回不停地在不同的基站控制区域里穿梭,而用户切换基站的时候,是需要设备和基站通信的,即使设备正处于RRC里的IDLE状态,也就导致了用户设备消耗更多的电量。为了解决这个问题,多个基站形成一个”tracking area”,core network并不知道用户连的是哪一个基站,而只知道用户在哪个tracking area里,需要发给用户的数据包就发给tracking area,tracking area内部再决定由哪一个基站把数据发给用户。这样做的好处是用户在tracking area内部的不同基站范围内切换时,处于RRC IDLE状态的设备不必再因为这个切换过程和基站进行通信从而节省了电量,坏处则是将数据包发给用户时可能需要更高的延迟。

Core Network(CN)

Core Network负责routing, accounting and policy management。在LTE中,Core Network也称为Evolved Packet Core(EPC)。

Packet gateway(PGW)将公网和Carrier Network相连,Carrier Network里的设备的IP地址由PGW分配管理。Carrier Network中的每个设备有一个内部标识符,当PGW收到数据包后,PGW像NAT一样,找到需要接收这个数据包的设备,然后这个数据包封装并通过管道发送给该设备。在Carrier Network内部,LTE使用SCTP(Stream Control Transmission Protocol)来传输control-plane的数据,用UDP和GTP(GPRS Tunneling Protocol)混合发送其他数据。
在IPV4情况下,PGW类似NAT,可能几十上百个设备共用了一个公网IP地址,一个设备可能会使用不同的IP地址和服务器通信。而在IPV6情况下,每个设备可能最终获得属于自己的独立IP地址。
在PGW和应用程序的TCP协议仍然保持着连接的同时,设备底层的天线是可以处于IDLE状态的,只要没有数据需要发送或者接收。而在需要传输数据的时候,便是RRC状态机转换的过程了。

The PGW also performs all the common policy enforcement, such as packet filtering and inspection, QoS assignment, DoS protection, and more. The Policy and Charging Rules Function(PCRF) component is responsible for maintaining and evaluating these rules for the packet gateway. PCRF is a logical component, meaning it can be part of the PGW, or it can stand on its own.

当PGW从公网收到数据包的时候,它并不知道用户的位置或者在哪个tracking area里,这是SGW(Serving Gateway)和MME(Mobility Management Entity)需要解决的问题。SGW其实也可能不知道用户在哪里,它需要从保存、跟踪这些信息的数据库MME里查询。

无论是哪一代的移动数据网络,大体结构都是这样的:

  • Data arrives at the external packet gateway, which connects the core network to the public Internet.
  • A set of routing and packet policies is applied at the packet gateway.
  • Data is routed from the public gateway to one or more serving gateways, which act as mobility anchors for the devices within the radio network.
  • A user database service performs the authentication, billing, provisioning of services, and location tracking of each user on the network.
  • Once the location of the user within the radio network is determined, the data is routed from the serving gateway to the appropriate radio tower.
  • The radio tower performs the necessary resource assignment and negotiation with the target device and then delivers the data over the radio interface.

LTE的EPC的一个特性是,该carrier network是基于IP-only的架构,并且用这个统一的网络同时传输数据和音频。

Backhaul Capacity and Latency

部署4G不只是部署基站这么简单,也需要升级Core Network才能支持相应的throughput和latency。

Packet Flow in a Mobile Network

Initiating a Request

LTE request flow latencies:

In summary, a user initiating a new request incurs several different latencies:

  • Control-plane latency
    Fixed, one-time latency cost incurred for RRC negotiation and state transitions:<100ms for idle to active, and <50ms for dormant to active.
  • User-plane latency
    Fixed cost for every application packet transferred between the device and the radio tower:<5ms.
  • Core network latency
    Carrier dependent cost for transporting the packet from the radio tower to the packet gateway: in practice, 30-100ms.
  • Internet routing latency
    Variable latency cost between the carrier’s packet gateway and the destination address on the public Internet.

前两个延时是由4G标准做了限制,Core network latency则与Carrier Network具体相关,Internet routing latency则可以通过将你的服务器部署的更靠近用户来解决。

Inbound Data Flow

LTE Inbound Flow Latencies:

Heterogeneous Networks(HetNets)

Real-World 3G, 4G and WiFi Performance

下图显示了ATT实验室和密歇根大学联合做的一个实验,WiFi和LTE以及其他无线网络标准的性能比较结果:

这至少显示了在某些情况下,LTE或者4G可以比WiFi的性能更好。

Chapter 8 Optimizing for Mobile Networks

Preserve Battery Power

使用att的Video Optimizer来帮助分析优化你的视频应用,该工具通过vpn收集移动设备的网络活动请求,并且可以记录设备RRC的状态转换过程。

Eliminate Periodic and Inefficient Data Transfer

无论发送数据量有多少,无线设备在用无线电发送数据时的耗电功率总是相同的。这就导致以下几点需要引起我们的注意:

  • Polling is exceptionally expensive on mobile networks; minimize it;
  • Where possible, push delivery and notifications should be used;
  • Outbound and inbound requests shold be coalesced and aggregated;
  • Noncritical requests should be deferred until the radio is active;

Eliminate Unnecessary Application Keepalives

TCP/UDP层面的连接状态与通信设备上的无线设备的状态是无关的:

the radio can be in a low-power state while the connections are maintained by the carrier network. Then when a new packet arrives form the external network, the carrier radio network will notify the device, promote its radio to a connected state, and resume the data transfer.
The application does not need to keep the radio “active” to ensure that connections are not dropped.
Most mobile carriers set a 5-30 minute NAT connection timeout. Hence, you may need a periodic(5 minute) keepalive to keep an idle connection from being dropped.

Anticipate Network Latency Overhead

RRC:Radio Resource Control
下图显示了一次http请求的延时的来源:

3G4G
Control plane200-2500ms50-100ms
DNS lookup200ms100ms
TCP handshake200ms100ms
TLS handshake200-400ms100-200ms
HTTP request200ms100ms
Total latency overhead200-3500ms100-600ms

Account for RRC State Transitions

对于RRC的状态转换遵循以下几点:

  • RRC state machines are different for every wireless standard
  • RRC state machines are managed by the radio network for each device
  • RRC state promotions to high power occur when data must be transferred
  • RRC state demotions to lower power occur on network-configured timeouts
  • (4G)LTE state transitions can take 10 to 100 milliseconds
  • (4G)HSPA+ state transitions are competitive with LTE
  • (3G)HSPA and CDMA state transitions can take several seconds
  • Every network transfer, no matter the size, incurs an energy tail

Decouple User Interactions from Network Communication

最好设计应用交互的时候就把等待网络请求的结果和给予用户即时反馈这两件事情分开,因为前者可能会花上比较长的时间,影响用户体验。

Design for Variable Network Interface Availability

把你的网络数据请求聚合起来,以少次多量的方式传输数据,这样你的网络通信设备可以大多数时间处于IDLE状态,增加电池使用时间。像LTE,HSPA+这种网络,他们以1ms的间隔来为用户调配网络资源,并且给予bursty data flows高优先级。

Burst Your Data and Return to Idle

Offload to WiFi Networks

需要传输大量数据时,最好选择在有WiFi的情况下进行。

Apply Protocol and Applicationo Best Practices