持久的tcp/ip连接如何保持电池电量并降低带宽使用率? [英] How does persistent tcp/ip connections preserve battery and lower bandwidth usage?

查看:152
本文介绍了持久的tcp/ip连接如何保持电池电量并降低带宽使用率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在推送通知机制(如Apple的Push Notification Service)中,它们使用持久IP连接.

In push notification mechanisms, like Apple's Push Notification Service, they use persistent IP connections.

我的问题是,采用持久连接如何节省设备的电池和带宽? 我的印象是,由于连接是持久的,因此设备始终使用WiFi或3G/LTE无线电.

My question is, how does employing persistent connections save battery and bandwidth of a device? I am under the impression that since the connection is persistent, then the device always uses the WiFi or 3G/LTE radio.

我知道,通过持久连接,您不会在没有变化时不询问服务器更改而浪费带宽,而是服务器将这些更改推送"给您.但是,我看不到如何节省电池和带宽(因为您一直与服务器保持连接).

I know that through persistent connections, you will not waste bandwidth by not asking the server for changes when there is none, and instead the server will "push" to you these changes. But, I don't see how that preserves battery and bandwidth (since you have an always-on connection to the server).

可以在这里找到类似的问题:
Android C2DM如何提高带宽使用率?
但我认为答案还不够.

A similar question can be found here:
How does Android C2DM improve bandwidth useage?
but I think the answers are not sufficient.

推荐答案

首先,您必须考虑设备实现的状态机,以控制由于网络通信而产生的功耗.您可以在此处看到它 阅读完之后,您会看到,如Adam所说,建立连接对您的电池寿命非常不利,而轮询则是关于建立/销毁连接的事情.

First you must have into account the state machine implemented by devices to control the power consumption due to network communication. You can see it here After reading that you will see that, as Adam said, creating connections is very bad for you battery-life and polling is about creating/destroying connections.

因此,C2DM避免创建连接以提高功耗.最后,节省是由于:

Therefore, C2DM avoids creating connections to improve power consumption. In the end, the saving is due to:

  1. 持久连接并不意味着设备始终处于全功率状态.这仅表示该连接未关闭,然后服务器可以向客户端发送消息.
  2. C2DM提供的消息具有不同的机制,您可以在 GCM高级主题.因此,可以将其配置为仅在设备已经处于全功率状态时传递消息
  3. 最后一个因素是GCM如何将消息传递到空闲设备.在官方文档中还不清楚,我认为Google Play服务的源代码不可用.不过,您可以在此处.第一条评论似乎很有用.
  1. A persistent connection doesn't mean that the device is always in full-power state. It only means that the connection is not closed and then the server can send messages to the client.
  2. C2DM delivers messages with different mechanisms as you can read in GCM Advanced Topics. Hence, it can be configured to deliver messages only when the devices is already in full-power state
  3. The last factor is how GCM delivers messages to idle devices. It is quite unclear in the official documentation and I think that the source code for Google Play Service is not available. Nonetheless, you can get some clues with the following answer here. The first commentary seems useful.

我不确定一点:我不知道他们如何使连接在低级别保持活动状态.那是我所想不到的.您可以阅读 Android C2DM 幻灯片15一些解释.看来它们提供了对状态机的某种巧妙处理.

There is a point I am not sure: I don't know how they keep the connection alive at low-level. That's the piece I am missing. You can read Android C2DM slide 15 for some explanation. It seems that they provide some kind of clever handling of the state machine.

这篇关于持久的tcp/ip连接如何保持电池电量并降低带宽使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆