Mobile dev meetup · From polling to push

Push cut our battery use by 22%, and we still poll

What changed when our app stopped asking for messages every 30 seconds, and why we kept a fallback anyway.

Before: every app asked our server for messages every 30 seconds

Polling timeline: a request every 30 seconds; a message that arrives just after a poll waits for the next one Poll at 0 sPoll at 30 sPoll at 60 sPoll at 90 s new message waits ~27 s for the next poll

That is 2,880 requests per device per day, and a delay of up to 30 seconds.

After: the server pushes through FCM and APNs, with a slow poll behind it

Architecture: our server sends through FCM to Android and APNs to iOS; apps also poll the server every 15 minutes as a fallback Our server FCM APNs Android app iOS app pushpush fallback poll every 15 minutes

Messages now arrive in about 1.2 seconds instead of up to 30

Delivery delay in seconds: push median about 1.2; polling up to 30 Polling up to 30 s Push median about 1.2 s 0 s30 s

The polling bar is the worst case; push is the median.

Our servers now handle 70% fewer requests

Server requests: polling set to 100; push with fallback poll at 30, a 70% drop Polling 100% Push 30% −70%

Requests to our server, with the polling setup as 100%.

Our app used 22% less battery in a one-week test

Battery used by our app: polling set to 100; push at 78, a 22% drop Polling 100% Push 78% −22%

Battery used by our app, before against after, one week on 40 devices.

About 3% of Android devices never got a single push

Some manufacturers ship aggressive battery savers that block them.

100 dots for Android devices; 3 highlighted that never received pushes each dot is 1% of Android devices3% never got a push

So we kept a poll, but slowed it from 30 seconds to 15 minutes

Polls per device per day: 2,880 at 30 seconds against 96 at 15 minutes Every 30 s 2,880 polls a day Every 15 min 96 polls a day

The slow poll is the safety net for devices whose pushes never arrive.

We still don't fully understand iOS's limits on background work

Android
We know the gap: about 3% of devices, and the slow poll covers it.
iOS
We don't yet know how its background limits apply to our case.

If you have mapped them for an app like ours, I'd like to hear how.

If you make the same move, do these three things

01

Keep a fallback

Some devices will never get your pushes.

02

Measure battery before and after

Our 22% came from a one-week test on 40 devices.

03

Test on the cheap phones your users actually have

Our missing pushes came from some manufacturers’ battery savers.