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

Excessive background data usage #131

Closed
mannes opened this issue Jan 8, 2016 · 15 comments
Closed

Excessive background data usage #131

mannes opened this issue Jan 8, 2016 · 15 comments

Comments

@mannes
Copy link

mannes commented Jan 8, 2016

App burned through my 4gb data bundle in a week.

I'm using zoneminder behind a http basic auth, which credentials it doesn't want to store (other issue, but perhaps related?)

@pliablepixels
Copy link
Member

The app does not consume data in the background (except for push notifications if you use it).
When its in foreground, it is by nature data intensive - each image it retrieves is a jpeg from ZM, refreshed every second or so depending on your refresh rate, plus every other element invokes APIs to ZM. I guess the nature of the app makes it data intensive.

Some data optimization tips:

a) Increase frame rate value in developer settings to a larger number - this dictates how often montage view will be re-loaded

b) Decrease percentage value of montage event scale and event image scale in dev settings (this will affect quality of images though)

c) Use timeline sparingly - its expensive by nature, reduce value of max elements to show in timeline

d) If you have many monitors, use montage view sparingly

@mannes
Copy link
Author

mannes commented Jan 8, 2016

Thanks for your reply.

When i check the app data usage in android it states 10.18mb foreground data, 1.41gb background data. Could it be it going into a login loop due to the failed logins? #132

I will monitor data usage after the suggestion you gave in #132

@pliablepixels
Copy link
Member

Whoops looks like I erroneously gave that suggestion on 132. Reposting here as I've closed 132

That's very odd. Can you please do this: put ZMNinja in background and then take a look at zoneminder (not zmNinja) logs and apache logs in your ZM server. Please let me know if you see lots of activity from zmNinja - if it is constantly hitting ZM, there is a bug somewhere

@pliablepixels
Copy link
Member

Bottom line, no matter what settings you use, zmNinja should not be using any background data. Unless, you have install the event server and its generating gobs of event notifications. Have you enabled zmeventserver?

The tips I gave above were only to reduce data consumption in foreground. I did not read it was a background data problem

@pliablepixels
Copy link
Member

@mannes any update to this?

@pliablepixels
Copy link
Member

So another user just contacted me with a similar problem. My guess is I am missing some key scenario to switch off timers and if you go to background mode during monitor or montage view, it keeps pulling images. I've asked the other user also to comment here

@legoman666
Copy link

I'm also having this issue. Used almost 4gb of data while in the background. I've since restricted background data to the app and am reluctant to reallow it.

@legoman666
Copy link

My wife's has used 156mb of background data also.

@pliablepixels
Copy link
Member

Can you help in narrowing the situation:
a) Go to montage view and go to back ground - then see logs - does it do background data?
b) Go to any other view and go to background - does it use background data?
c) Which OS version?

@pliablepixels
Copy link
Member

Okay, I think I know what is going on -- since I've added support for streaming via nph-zms (its enabled by default now), ZM keeps a socket open with the app and keeps streaming images. So even if the app goes to the background, it keeps receiving images.

I think I've fixed it - I've only tested on an emulator for now as I am on travel and don't have an Android device handy. Once I get back home over the weekend, I'll test it with my device on Monday and make a temporary release for a quick test. @legoman666 - would it be possible for you to do a quick test for a debug version before I make an official release? If so, please shoot me an email with your phone type (and if you know its an arm or x86 processor) and I'll email you a link to a test build on Monday

This was an ugly bug that crept it. Hope my fix resolves it.

@pliablepixels
Copy link
Member

Okay, I really think I've got it now.
I believe the problem was nph-zms was not terminating connections.

Please give the new version a go (please delete the old one). I'll email a link

To measure network bandwidth on the server side, I used nethogs - it shows you network consumption per process - basically look for apache processes being spawned as you view feeds -- and when you exit/move along they should gracefully die to 0kbps network consumption a few seconds after you move on in zmNinja

Do let me know

@legoman666
Copy link

I'm headed out if town and won't be back until at least Tuesday so it will
be a couple days before I can say for sure if it fixed it. But I'll install
it now.

Cheers,
Andy
On Jan 18, 2016 6:04 AM, "Pliable Pixels" [email protected] wrote:

Okay, I really think I've got it now.
I believe the problem was nph-zms was not terminating connections.

Please give the new version a go (please delete the old one). I'll email a
link

To measure network bandwidth on the server side, I used nethogs - it
shows you network consumption per process - basically look for apache
processes being spawned as you view feeds -- and when you exit/move along
they should gracefully die to 0kbps network consumption a few seconds after
you move on in zmNinja

Do let me know


Reply to this email directly or view it on GitHub
https://github.com/pliablepixels/zmNinja/issues/131#issuecomment-172498438
.

@pliablepixels
Copy link
Member

I'm closing this for now - I've been testing various scenarios over the last 2 days on Android and in all cases, I see data going to 0 quickly after moving to background (within a few seconds). If you see that not to be the case, please reopen - I need to close it to be able to make a release and document it in my CHANGELOG

@mannes
Copy link
Author

mannes commented Jan 20, 2016

I was planning on providing you with the logs but didn't find the time. Thanks for solving it! Got the new version from the play store today

@pliablepixels
Copy link
Member

No problem. I'm still interested to know if it's solved for you - so please check and let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants