views:

1264

answers:

2

I've read some articles on the web and some questions on StackOverFlow, but no one seems to have a definite answer over a) If google uses Long Lived TCP connections for Gmail, Mail etc, and b) If using it in a custom app will drain battery life , and if so roughly how much?

+1  A: 

Maintaining an open-connection can translate to less resource usage: a small "trickle" traffic can maintain the connection open.

Consider the opposite situation: the Client "polls" the server on a regular interval (assume the same "refresh" rate as for the long-lived connection "trickle") : each time a new connection is opened generates more traffic.

Connection setup/teardown is expensive (of course, everything is relative in this universe ;-).


Major drawbacks of maintaining an open connection:

  • the client side browser might be limited in the number of connections per window/tab etc.
  • intermediate devices (e.g. NAT, Firewalls) can't reuse the port as often to serve other requests
jldupont
@jidupont - So If im reading this correctly, keeping the connection "persistent" will take up less resources then polling every n seconds (sounds reasonable to me).@Everyone-else - The traffic will be 0 for a long long time till the user does the action that starts the push from the server, (the action is done on the computer) however it will be a pain in the ass for the user if he has to enable "push" each time he wants to do this, thus I thought about just let it run if it really doesn't take a lot of resources. What do you guys think?
Faisal Abid
+1  A: 
  1. You can use a tool like tcpdump or wireshark on your router or other machine to determine how long the TCP connections are kept open by Google's applications. You will need to filter on the ports or addresses you are interested in.
  2. If you are using Android 1.6, the best way to determine the drain is to use the new battery usage indicator. Just install your custom app and see what the monitor says over time.
Adam Goode
True that is a really good idea. I think i should just run a custom app that just leaves the connection open and nothing else for a while to see the battery usage.
Faisal Abid
If I look at the Email Client, and the Google Apps suite (Gmail and Calendar) they both take up roughly 5-6% of the battery life.
Faisal Abid