Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High Power Consumption #368

Closed
wewondr opened this issue Apr 22, 2015 · 50 comments · Fixed by #1051
Closed

High Power Consumption #368

wewondr opened this issue Apr 22, 2015 · 50 comments · Fixed by #1051

Comments

@wewondr
Copy link

@wewondr wewondr commented Apr 22, 2015

Hello!
Today I noted an excessive power consumption of the app (on the second day of use). Synchronization is turned on only in WLAN. There were seven photos to transfer (14 MB via WLAN) and this required 8% of the total battery power. The sync works beautiful, but the power consumption is to much!
Syncthing Version: v0.10.30
Syncthing-Android Version: 0.5.28
Sony Xperia Z1 Compact
Android 4.4.4

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Apr 22, 2015

Are there two android devices involved by any chance?
Also, it would be useful to see how much network traffic was consumed to sync these 14mb, as that could indicate that the power consumption is due to the protocol chatter.

@wewondr

This comment has been minimized.

Copy link
Author

@wewondr wewondr commented Apr 22, 2015

No, it's a sync between Android and Windows. Sadly I don't see the wlan network traffic of the app. No mobile data where used by the app (like the config is).

Am 22. April 2015 22:28:06 MESZ, schrieb Audrius Butkevicius notifications@github.com:

Are there two android devices involved by any chance?
Also, it would be useful to see how much network traffic was consumed
to sync these 14mb, as that could indicate that the power consumption
is due to the protocol chatter.


Reply to this email directly or view it on GitHub:
#368 (comment)

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Apr 22, 2015

You can see the traffic used in system settings ("Data Usage").

Duplicate of #349?

@wewondr

This comment has been minimized.

Copy link
Author

@wewondr wewondr commented Apr 23, 2015

@ManuelSchneid3r

This comment has been minimized.

Copy link

@ManuelSchneid3r ManuelSchneid3r commented Jun 11, 2015

Can confirm the high power consumption. Today 18% of my battery, for transferring 13,9MB of data (wlan usage).

@strout

This comment has been minimized.

Copy link

@strout strout commented Aug 24, 2015

"Me too" here. Android app info claims >3h CPU usage (of 6h total uptime) and 840B (bytes) sent/received.

One of the directories I'm syncing has symlinks in a sub-subdirectory (from a Linux machine) that are repeatedly retried/failed. That may be contributing somehow; I'll try deleting them.

@Nutomic Nutomic added the enhancement label Jan 22, 2016
@endolith

This comment has been minimized.

Copy link

@endolith endolith commented Feb 12, 2016

This is a problem for me, too. I tried to sync my SD card for backup purposes and the phone becomes very hot and locks up and becomes unresponsive whenever syncthing is running.

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Mar 14, 2016

Same here : battery drain is huge ...

1 folder sync'ed between Android 5.0.1 (Galaxy S4) and a server.

Hoping it will get solved in a foreseeable future ...

@lkwg82

This comment has been minimized.

Copy link
Member

@lkwg82 lkwg82 commented Apr 10, 2016

@GLLM What is your version? I do have the same and everything was fine with android 4.4 and cm13 (android 6)

When you take a look into battery stats, how much percent is syncthing taking?

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Apr 20, 2016

Hi !

My Server/NAS are on both on v0.12.22

Phone is on Android syncthing v0.7.11 (i.e. Syncthing v0.12.20) > Edit : cos I'm using F-Droid repo :S

The app can take like ~20/25% of the battery consumption of my phone in <30min ...
It's therefore unusable on a background sync basis.

So I launch it manually from time to time, then exit it + kill the process (simply exiting it on android does not stop the power leakage)

Thanks.

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Apr 22, 2016

I've tried what I was reluctant do to : remove the app (initially from FDroid) and installed the one on Google Play, which is in a higer version 👍

  • battery consumption is much less worrysome
  • still : today, it is still the first battery eater program with 8% as of now, ahead of Android system, display & twitter.

So it's improved yet not perfect (Dropbox seemed to be using almost nothing even though it was syncing live)

Thx

@wweich

This comment has been minimized.

Copy link
Member

@wweich wweich commented Apr 22, 2016

The battery statistic isn't really accurate.
After I activated the wake lock to prevent syncthing from being killed while the phone is in deep sleep, it changed from 2-3% to 10-18% in battery statistic, but the overall battery consumption (battery drain on a typical work day) didn't change a bit.

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Apr 26, 2016

Hi

I've upgraded to 0.7.15.
And even thought battery stats are not accurate : my battery drain is still huge. And this drain did NOT happen prior to using Syncthing on my phone.

syncthing_battery_issue

Dont know what to do.
But now I'm at 10% at 20h00, I was at 40 beforehand ... on average

GLLM

@licaon-kter

This comment has been minimized.

Copy link
Contributor

@licaon-kter licaon-kter commented Apr 26, 2016

Picture of Syncthing battery details?
Picture of Syncthing network activity (mobile and/or Wi-Fi) details?

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Apr 26, 2016

If its disconnecting often or sending a lot of data, battery usage is expected.

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Jun 6, 2016

Hello again,

I did not log for quite some time.
Here's some feedback:

  • been upgrading to each & every binary version on my phone, server & NAS
  • been noticing a daily drain between 20 and 35% on a daily basis even though no changes were made in my sync'ed folders (android photo folder)
  • never had any battery issue with dropbox, priori to dropping & deleting my account in favor of Syncthing

Today is (no new pics taken)
syncthing_batt

batt2
batt3

It's getting annoying :(

What more info can I provide ?

Thanks.

@licaon-kter

This comment has been minimized.

Copy link
Contributor

@licaon-kter licaon-kter commented Jun 6, 2016

Look at that signal, why do you believe you have 4G/LTE there? That constant switching and searching (orange/red signal colour bar) eats up your battery.

Do this for a test, limit Syncthing only on Wi-Fi for a day (start at 100% battery) and see how that fares.

@wweich

This comment has been minimized.

Copy link
Member

@wweich wweich commented Jun 6, 2016

The battery meter from Android doesn't say much. When I enabled the experimental wake lock option, syncthing jumped from 2% to ~15% in the Android battery meter, but the real battery drain didn't really change.

@GLLM

This comment has been minimized.

Copy link

@GLLM GLLM commented Jun 14, 2016

@licaon-kter
I did stop the synchro over LTE and only kept that over WiFi and it basically stopped the battery drain. So it seems you were right.
However, the same settings with Dropbox (sync over LTE, in the same place with the same average reception quality) never induces the same battery leakage, or at least not in the same order of magnitude... hence my surprise !

I'll keep the sync over WiFi for a while and consider if this has any drawbacks I cannot do with.

Cheers
GLLM

@capi

This comment has been minimized.

Copy link
Member

@capi capi commented Jun 14, 2016

It might be that in your area you get a lot of re-connects when using LTE/3G (e.g. on every switch between those two technologies), causing a complete handshake to be sent. How was the data usage for Syncthing?

@lkwg82

This comment has been minimized.

Copy link
Member

@lkwg82 lkwg82 commented Jul 26, 2016

relates to #671

@micahscopes

This comment has been minimized.

Copy link

@micahscopes micahscopes commented Feb 4, 2017

I'm having this issue too. Only syncing over wifi. If there are stuck folders (out of sync master folders), syncthing can nail my battery in a matter of hours.

But even when "resting" (not syncing, no stuck folders), it seems to take at least 25% of my battery life. I'm hardly changing any files for this to happen. Compared to Resilio, which is taking a fraction of a percentage while resting.

@wweich I'm using GSAM to analyse the battery. It's much more accurate than the Android meter.

@hubyhuby

This comment has been minimized.

Copy link

@hubyhuby hubyhuby commented Mar 11, 2017

TEST ON BATTERY LIFE:
Syncthing 0.14.16 consum way too much battery on Android in IDLE scenarios.
Running for 9 hours at night Syncthing consumed 14% of my battery doing nothing.
This mean roughly in a 24Hours day it should be responsible for 35% of battery lost when doing nothing at all.
I believe a Goal for this app would be to drain around 10% / day in IDLE scenarios (like this one).
We are 2-3X too high.

TEC SPECS:
Samsung galaxy a3 2016
Android 6.0.1
Dedicated relay server and @server with 5 persons using it
Two android phone sync (with the other on off)

DATAS:
I have lost 24% battery in 9H05 away from the power plug during a night
Not using the phone during this test (network stanby
Syncthing used 57% of the battery during this time (57% of 24% = 14%)

batterysyncthing

PS: Bonjour @GLLM , @AudriusButkevicius : I have exactly the same conclusions as you. I believe the problem is the IDLE consumption of power.
This and the SD card not usable are big drawbacks for now ;)

@micahscopes

This comment has been minimized.

Copy link

@micahscopes micahscopes commented Mar 11, 2017

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Mar 11, 2017

@hubyhuby Android 6.0 is an unfortunate case, because inotify is broken. For this reason, we do folder rescans every 60 seconds with the default configuration. You can increase that interval in the web gui if thats okay for you.

@hubyhuby

This comment has been minimized.

Copy link

@hubyhuby hubyhuby commented Mar 11, 2017

@AudriusButkevicius Thks.
I have set the parameter for my rescanIntervals of my two folders to 300 (seconds I guess;).
1)BUT the value is always reseted to 0:
-I save the parameters
-If I go back RIGHT away it is still 300
-I go back in the normal GUI
-I come back in web gui => back to default 0

  1. I noticed many parameters there, and was wondering if some other could help with the battery issue ?

Thks for your help
Yann

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Mar 11, 2017

Do you save the folder settings after you change the rescan interval? It should also show the changed rescan interval after you close the folders settings. And I dont think any of the other settings would affect battery usage.

@micahscopes

This comment has been minimized.

Copy link

@micahscopes micahscopes commented Mar 11, 2017

@hubyhuby

This comment has been minimized.

Copy link

@hubyhuby hubyhuby commented Mar 12, 2017

@AudriusButkevicius, @Nutomic , My problem is closed.

I am using my own compiled version of the project. Which is not supposed to change this behavior...but in the end is generating the bug wis the "rescanIntervals" !
To be sure I have installed your original V0.9.3 with sync 0.14.16 and it does work PERFECTLY for the parameter setup.

Thanks a lot for your help. Sorry for the disturbance.
I will now make sure to report every issue with the original Syncthing for android installation.

@hubyhuby

This comment has been minimized.

Copy link

@hubyhuby hubyhuby commented Jun 7, 2017

Dear @Nutomic ,
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.
Also the phone keeps on saying we have to "optimise" the app, means shut it down ;) Even after you give all the usual autorisation to keep the app eating your batterie.

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 :(
screenshot_20170606-161758

screenshot_20170606-161837

screenshot_20170606-190143

Note: the A3 2017 is the 2nd most power efficient phone in the world as for today. And I "feel" when I start syncthing after few hours that I am not going to reach the end of the day... Even on a testing perspective I never let syncthing work more thant 2 to 3 hours!
I really believe there is a factor 4X in improvement.
If we could reach a factor 2X it would already mean we can use the app. Otherwise it is a no go for me at least ;)

@hubyhuby

This comment has been minimized.

Copy link

@hubyhuby hubyhuby commented Jul 5, 2017

Hi @AudriusButkevicius ,
Now I think, I may have catched something more precise concerning battery usage after some testing.
After some time (maybe around 1H30) on my device Samsung A3 2017 with android 6, I have 50% increase in CPU usage wether I have folder synchronised or not.
This is CONSISTENTLY hapening at least on my device. Would be nice to have a confirmation from someone out there .

EDIT: the 1h30 thing comes I think from the samsung graph representation of consuption... But anyhow their is no reason there is a 50% increase in CPU... specially at 4AM while sleeping

screenshot_20170606-161758

Here I am using my modified version, but _ have exactly the same behaviour. Not that at 4AM in the morning I was sleeping....nothing was hapening on my phone:
screenshot_20170705-054253

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Jul 6, 2017

It would probably be helpful if you can catch some logs during that time. Possibly with debug flags enabled.

@nicuh

This comment has been minimized.

Copy link

@nicuh nicuh commented Aug 13, 2017

Syncthing Version: v0.14.32
Syncthing-Android Version: 0.9.12
Samsung S6
Android 7.0

I had the same issue - the battery consumption was high.
Even with a folder sync interval set to 3 days the folders where scanned approximately every 10 minutes. Also the Uptime of Syncthing binary was about 10-15 minutes. Which means the binary was restarted even the battery optimization was set to off. And on every restart, the folders are scanned.

I tried everything, all the combinations of settings, like Always run in background, with and without Sync only on wifi, with and without Run service with foreground priority - all without success.

In the end, the solution that worked for me was to disable restartOnWakeup in the advanced settings. It seems that Syncthing detects the phone is in standby and restarts itself:

Whether to perform a restart of Syncthing when it is detected that we are waking from sleep mode (i.e. a folded up laptop).

Before the change, Syncthing was in top 3 applications of battery consumption. Now it's not even in the list.

Here are the steps for disabling it:

  • Go to Web GUI
  • Click on Actions menu button and choose Advanced
  • Find restartOnWakeup in the Options section and uncheck it
@capi

This comment has been minimized.

Copy link
Member

@capi capi commented Aug 17, 2017

@nicuh Sounds interesting, need to dig into that.

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Aug 18, 2017

I'm not having any trouble with battery usage, but if other people can confirm that disabling restartOnWakeup solves the problem, we could do that by default for everyone.

@acolomb

This comment has been minimized.

Copy link

@acolomb acolomb commented Aug 18, 2017

I can confirm that it betters the situation on my device - LG G4 with LineageOS / Android 7.1.2. At least I have Syncthing backround processes now running for several hours at a time, until I lose my WiFi connection (run conditions active).

Sometimes I still get serious battery drain from a libsyncthing.so process eating one or two complete CPU cores, around 24 - 49% CPU usage according to the OS Monitor app. I suppose this is not syncthing-android's fault. May be related to #910? I will try to get some logging output when I catch it again and have some spare time.

Anyhow, restartOnWakeup = false by default seems like an essential improvement for the app to me. Otherwise a power-hungry rescan after each device sleep phase kind of renders sleeping pointless.

@capi

This comment has been minimized.

Copy link
Member

@capi capi commented Aug 18, 2017

As I use the foreground service option (otherwise Syncthing is killed off on my device), it doesn't make a difference, since my device never enters CPU sleep mode. But for people that don't need this, it really could make a difference, if Syncthing does not restart itself once it detects the clock forward jump after waking up from CPU sleep.

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Aug 19, 2017

syncthing/syncthing#565 is the ticket that is being addressed by this.
Given it's very old, I'd say it would need more testing to see if everything works as expected without restarting.

I know for a fact things like UPnP and discovery will take some time to correct themselves, but it probably doesn't make much sense on a mobile anyway.

@Nutomic

This comment has been minimized.

Copy link
Member

@Nutomic Nutomic commented Aug 20, 2017

We could use the experimental options in the app for this. Then the question is just if we should set restartOnWakeup = false by default, or only let users do it themselves.

@plittlefield

This comment has been minimized.

Copy link

@plittlefield plittlefield commented Mar 13, 2018

android_battery_syncthing_usage

Oh, it's not normally this bad.

Google Pixel (sailfish), Android 8.1.0, Syncthing for Android 0.10.5

@wweich

This comment has been minimized.

Copy link
Member

@wweich wweich commented Mar 13, 2018

Version 0.10.5 is broken, so it connects over and over just to get disconnected as soon as the index exchange starts. No wonder it uses so much battery.

@plittlefield

This comment has been minimized.

Copy link

@plittlefield plittlefield commented Mar 13, 2018

OK, so just keep the charger close by for now until a fix? ;-)

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 22, 2018

According to https://forum.syncthing.net/t/question-about-restartonwakeup-setting/2222/14 restartonwakeup should be the default setting for syncthing android.
image

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 23, 2018

I am working on the "restartonWakeup" option in the app.

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 23, 2018

It's implemented in the UI and migration PR #1051 mentioned above.
Users with an existing configuration can manually toggle restartOnWakeup off in the app UI.
Users creating a new configuration on first start of the app get restartOnWakeup by default.

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Apr 23, 2018

Switching it off is not for free. You are trading battery usage for "my syncthing doesn't connect"

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 23, 2018

Lets see what new users report back. I am currently testing myself.

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 23, 2018

This discourse is over 3 years old, so we should at least give it a try as other users (see post above), calmh and me already found the battery saving the better option to live with on low-power devices. Plus, ignoring android doze syncthing core should not get in the state of being put to "standby" (timer increasing while app is frozen as interpreted by st core) so choosing between restartonwakeup or not is irrelevant to users living on Android 6+. Do you agree on having it easily configurable in the next version? That ensures, no one gets a showstopper when the change is released.

@AudriusButkevicius

This comment has been minimized.

Copy link
Member

@AudriusButkevicius AudriusButkevicius commented Apr 23, 2018

I agree in it being configurable, yet not disabled by default as the wider effect on all device base is not clear. Ideally this should come with a disclaimer explaining the effects.

If we are not being put into doze, then syncthing shouldn't be restarted, hence should not consume more battery.

@Catfriend1

This comment has been minimized.

Copy link
Contributor

@Catfriend1 Catfriend1 commented Apr 23, 2018

@AudriusButkevicius: ok, I'll update the pr to make it enabled by default so no change is forced on new users. The disclaimer string will also be updated.

Catfriend1 added a commit to Catfriend1/syncthing-android that referenced this issue Apr 23, 2018
AudriusButkevicius added a commit that referenced this issue Apr 27, 2018
* Added UI experimental option to enable/disable FolderObserver

* Disable android watcher by default.

* WIP - dismiss file watcher notification

todo - SyncthingRunnable has to run and migrate the config v27>28 before the file watcher notification can be dismissed.

* fix object type

* remove unackednotifications instead of altering it

* removed extra blank lines

* fix removeChild

* updated syncthing to v0.14.47-rc.2

* WIP - log remove of unackedNotificationID

* WIP - improved config migration 27>28

Prevent generating the unackedNotification fsWatcher in WebGUI by manual bumping the config version to #28.

* fix typo

* WIP - polish version bump code

* syncthing/imsodin-debugAndroidWatch

* update syncthing to v0.14.47-rc.3

* fix NPE on first app start

* fix pref condition

* add ConfigXML support for fsWatcher transition

Added UI experimental option to enable/disable FolderObserver

Disable android watcher by default.

WIP - dismiss file watcher notification

todo - SyncthingRunnable has to run and migrate the config v27>28 before the file watcher notification can be dismissed.

fix object type

remove unackednotifications instead of altering it

removed extra blank lines

fix removeChild

updated syncthing to v0.14.47-rc.2

WIP - log remove of unackedNotificationID

WIP - improved config migration 27>28

Prevent generating the unackedNotification fsWatcher in WebGUI by manual bumping the config version to #28.

fix typo

WIP - polish version bump code

syncthing/imsodin-debugAndroidWatch

update syncthing to v0.14.47-rc.3

fix NPE on first app start

fix pref condition

* updated syncthing to v0.14.47+3d02fcd notify-fix

* updated ConfigXml, FolderObs explanation, st 0.14.47-rc.4

* fixed string escape

* add restartOnWakeup setting to the UI

* restartOnWakeup = false by default on first app start and config generation

* improved logging of restartOnWakeup option to produce meaningful logs

* restartOnWakeup enabled by default
see discussion in #368

* PR improved according to review

* fix intendation - Atom Tab Indent = 4

* move configXml migration to separate function

* changeLocalDeviceName only affects "self device" - fixes #1059

* revert changeLocalDeviceName fix

* fixed changed result in migrateSyncthingOptions

* improved dismissing unackedNotificationID

* extend folder settings UI by fsWatcherEnabled checkbox

* remove FolderObserver

+ Constant.PREF_USE_TOR according to AudriusButkevicius' review added instead of static strings

* remove folderchange listener

* WIP - temporary - restApi logging

for better understanding whats going on

* prevent removingthe wrong unackedNotificationID

* fix build

* give me more log

* fix PostConfig REST request not working

due to missing fields in the folder model

* remove unused string

toast_folder_observer_stack_overflow using AndroidStudio

* fix typo

* trigger rebuild

* fix UI icon

* Revert to Syncthing to 0.14.46 and cherry-pick

* improved code according to review

* fix translation indent
@syncthing syncthing locked and limited conversation to collaborators Apr 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.