Android app consumes too much battery when IDLE

There is an issue opened since 2015 on battery usage: High Power Consumption · Issue #368 · syncthing/syncthing-android · GitHub

I believe there is a factor 4X in improvement possible for IDLE power consuption. If we could reach a factor 2X it would already mean we can use the app. Otherwise it is consuming way too much (see attached pic) Battery is really critical for smartphone, if I have to let my phone plug to a wall…this is a regular PC…not a phone :smiley:

I have tried the latest version of Syncthing (not my compile;) ), on samsung galaxy a3 2017 android 6.0.1. Interestingely Samsung is providing a profiling of the Syncthing app over time. Which shows a huge increase of consumsion after 2 Hours. The phone keeps on saying we have to “optimise” the app, means shut it down after 1 hour;)

In short , users are prety much invited not to use syncthing, which is a problem I believe. Please note that I have NO folder synchtonised, Syncthing is just supposed to be sitting IDLE. An app like whatsapp that I use all the time consume 7%. And Syncthing IDLE consume 27% of my batterie in the same time :frowning:

QUESTION: a) What could make this huge increase in power used after 2 hours b)Is iddle power used by syncthing service or android java ap? c)If it is the service, could we stop and restart it every hour for example as a workaround ?

Pictures of consuption of batterie, without any folder synchronised :

: https://user-images.githubusercontent.com/26340942/26892358-533ccd56-4bb8-11e7-87bf-6b671d1d73c9.png

Anyone is experiencing the same problem on the forum ?

Hi @Ian1,

I had a similar issue but on Android 7.0. I just posted the solution on https://github.com/syncthing/syncthing-android/issues/368.

Not sure if will work for you but it worth a try.

The one issue that causes battery drain is file syncing errors. When syncthing encounters errors, it keeps trying these files forever very frequently therefor causing a lot of battery usage. This is most ot the time not user fault but some sync related issue.

I realized this causality when I moved from the gui app to arm compiled version in terminal (like termux) where I could see the logs. Trying to fix these sync issues (like ignoring, deleting troubling files etc) massively decrease the cpu use.

Also syncthing client can get very chatty with other clients, which in my opinion is the another battery sucking “feature” of syncthing.

1 Like

Hi @Nicuh, i have tried it yesterday "restartOnWakeup " OFF, but it doesn t seam to change anything on my android 6.0. After 8H the app with nothing to sync; uses 25% of the batter (3% / hour as samsung says).

It looks like we have several battery draining causes…

My guess would be that it, while running, keeps network sockets open and sends pings over them. This prevents the CPU and cellular modem / WiFi from sleeping.

Dear @calmh, That s exactly my guess too !!! I have found that when on WIfi it uses much less power than on 4G. I believe this is because it cost much less power to send on Wifi data ALL THE TIME. On wifi syncthing uses 3% per 8 hours on 4G 25% sittinf IDLE! The battery cost of sending packets over wifi is much lower than 4G, therefore it stays unoticed for wifi users.

We need to implement something around this solution explained by android devs, it is called “BATCHING” and "SCHEDULING" https://developer.android.com/topic/performance/power/network/action-app-traffic.html

https://developer.android.com/topic/performance/power/network/index.html

Happy this issue is on the agenda

Cheers Hubyhuby

It is not on the agenda, as such. However the batching mentioned there could be implemented by the Android wrapper as something simple like pausing all devices, and then periodically:

  • unpausing
  • giving things a while to connect
  • observing sync status; if syncing, leave it connected for a little while longer
  • when all connected devices are in sync, pause all devices
2 Likes

Oh, it’s not normally this bad.

:frowning:

Paully

Google Pixel (sailfish) Android 8.1.0 Syncthing for Android 0.10.5

I think it is related to the bug in the latest version.

Or maybe not… I have the latest syncthing for Android app installed (0.10.6, with syncthing 0.14.45), and I’m still getting way too high CPU usage. The app itself says it uses less than 5% of CPU, but if I go to the app monitor, I see a usage around 20 or 25%. And I fear the monitor is right, since my battery gets drained much faster than usual if I leave syncthing running. My device is a Samsung Galaxy Note 3 with Android 5.0.

I’ve noticed high CPU and battery usage too, with Android versions 0.10.5 and 0.10.6. Not noticed a problem with precious versions.

I should explain that in my case the battery drain occurs if “Always run in background” is ticked (I also have “Run only on WiFi” ticked). Same settings prior to Android 0.10.5 didn’t have this problem as far as I know.

All my folders are synced and I also reset the database, but still the drain occurs. I have three synced folders, 7 files/400 KiB, 700 files/2.5 GiB, 6 files/180 MiB. Scan interval is 5 mins.

Huge power consume on two Xperia Z2 with latest Syncthing.

In that 30 minuttes xiia was playing internetradio.

Second Z2

I switched back to Syncthing for Android v0.10.4 via FDroid (that still has it) and the battery consumption issues are gone. Now I see CPU usage for Syncthing when idle at 0% when it was at 20~25% with the next versions… I hope this version will keep on working.

1 Like

So I’d love to fix this but I can’t repro on my pixel.

I can actually reproduce on my Samsung Galaxy S4. It drains the battery much faster than it did before without any changes to the configuration (of Syncthing or the Phone).

Maybe I can look into it, but I haven’t been developing for Android for quite a while now and I think the usage of Go makes this even harder than average. But I could gather some logs at least.

The workaround is currently to only enable the app if I want to sync something. It is ok, but far from ideal.