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

OSX Maverick "App Nap" slowdown #3182

Closed
gavinandresen opened this Issue Oct 29, 2013 · 14 comments

Comments

Projects
None yet
9 participants
@gavinandresen
Contributor

gavinandresen commented Oct 29, 2013

Reported via email:

The only issue I've come across period, isn't really a problem. But it is confusing to someone downloading Bitcoin-Qt unaware of OS X Maverick's under the surface options. When I first opened it up and set if off downloading the blockchain I thought there was a problem as it was doing it incredibly slow. Much slower than usual. And when I clicked on the battery icon at the top of the screen, there's a new feature in Mavericks which lets you know of "Apps Using Significant Energy". When Chrome was the only app that appeared I realized something was wrong.

I had a bit of knowledge about a new feature in Mavericks called App Nap and I had a hunch it was something to do with that. It was. App Nap is a new feature designed for optimizing battery life that puts background/non-visible apps with no audio, video or otherwise relevant to current usage, to sleep. So whenever I was browsing in Chrome, Qt was fully napping. I have since read that there's a full App Nap API for developers to take advantage of to tweak which parts or aspects of an app can or can't be put to sleep, or turn off napping of the app full stop; so devs have control over this feature, but it is enabled by default.

Until then, I figured out a simple way to turn off app napping on the user's side with any app as well. You can right click any app, click Get Info, and at the top there's a new checkbox named Prevent App Nap. I imagine this is useful to anyone, or yourself, using Qt on Mavericks as doing anything without it seems to completely stop Qt from synchronising with the blockchain.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Oct 29, 2013

Member

Seems that we need even more mac-specific code :)

Member

laanwj commented Oct 29, 2013

Seems that we need even more mac-specific code :)

@TheButterZone

This comment has been minimized.

Show comment
Hide comment
@TheButterZone

TheButterZone commented Oct 30, 2013

@jemmons

This comment has been minimized.

Show comment
Hide comment
@jemmons

jemmons Nov 5, 2013

App Nap and compressed memory are orthogonal technologies. They really don't have much to do with one another.

jemmons commented Nov 5, 2013

App Nap and compressed memory are orthogonal technologies. They really don't have much to do with one another.

@mikehearn

This comment has been minimized.

Show comment
Hide comment
@mikehearn

mikehearn Nov 13, 2013

Contributor

The core problem here is that running highly intensive background processes on battery powered devices is a stupid thing to do, which is why Apple has been "cracking down" on it.

At some point we need to bite this bullet. Until it gets an SPV mode, Bitcoin-Qt does not make sense to run on laptops. Simple as that.

Contributor

mikehearn commented Nov 13, 2013

The core problem here is that running highly intensive background processes on battery powered devices is a stupid thing to do, which is why Apple has been "cracking down" on it.

At some point we need to bite this bullet. Until it gets an SPV mode, Bitcoin-Qt does not make sense to run on laptops. Simple as that.

@raarts

This comment has been minimized.

Show comment
Hide comment
@raarts

raarts Nov 16, 2013

@mikehearn : can you please enlighten? Laptops seem to becoming the norm. My backup client for example gives me the choice to pause when battery drops below a configurable threshold. I just installed Bitcoin-qt, do you think that was a bad choice?

raarts commented Nov 16, 2013

@mikehearn : can you please enlighten? Laptops seem to becoming the norm. My backup client for example gives me the choice to pause when battery drops below a configurable threshold. I just installed Bitcoin-qt, do you think that was a bad choice?

@mikehearn

This comment has been minimized.

Show comment
Hide comment
@mikehearn

mikehearn Nov 16, 2013

Contributor

If you're OK with long sync times and so on go right ahead and use it, but it's a very computationally intensive app so you should expect it to use a lot of battery power (a lot more than your other apps)

Contributor

mikehearn commented Nov 16, 2013

If you're OK with long sync times and so on go right ahead and use it, but it's a very computationally intensive app so you should expect it to use a lot of battery power (a lot more than your other apps)

@raarts

This comment has been minimized.

Show comment
Hide comment
@raarts

raarts Nov 16, 2013

So, from a battery power standpoint, what would be the best alternative?

raarts commented Nov 16, 2013

So, from a battery power standpoint, what would be the best alternative?

@mikehearn

This comment has been minimized.

Show comment
Hide comment
@mikehearn

mikehearn Nov 16, 2013

Contributor

An SPV client that doesn't process the whole block chain.

Contributor

mikehearn commented Nov 16, 2013

An SPV client that doesn't process the whole block chain.

@gubatron

This comment has been minimized.

Show comment
Hide comment
@gubatron

gubatron Nov 21, 2013

Contributor

We also have this same issue on FrostWire, the simplest way to solve it (if you want the app marked as disabled from the start from AppNap) is to invoke the following command:

Supposedly doing this would disable AppNap, but I just tested and it doesnt.
defaults write org.bitcoinfoundation.Bitcoin-Qt NSAppSleepDisabled -bool YES

What I know for a fact, is that if you disable app nap on the Get Info dialog, the application will be added to a Dictionary inside the file ~/Library/Preferences/com.apple.LaunchServices.plist

If I understand correctly we can use the Qt QSettings class to edit that property file programatically in MacOSX, we could alter the file ourselves on the first run if we detect Mavericks.

I'd be glad to submit a patch doing this to get myself warmed up. I also read there's an issue building on Mavericks, I'm probably going to have to solve it for myself If I want to collaborate.

Contributor

gubatron commented Nov 21, 2013

We also have this same issue on FrostWire, the simplest way to solve it (if you want the app marked as disabled from the start from AppNap) is to invoke the following command:

Supposedly doing this would disable AppNap, but I just tested and it doesnt.
defaults write org.bitcoinfoundation.Bitcoin-Qt NSAppSleepDisabled -bool YES

What I know for a fact, is that if you disable app nap on the Get Info dialog, the application will be added to a Dictionary inside the file ~/Library/Preferences/com.apple.LaunchServices.plist

If I understand correctly we can use the Qt QSettings class to edit that property file programatically in MacOSX, we could alter the file ourselves on the first run if we detect Mavericks.

I'd be glad to submit a patch doing this to get myself warmed up. I also read there's an issue building on Mavericks, I'm probably going to have to solve it for myself If I want to collaborate.

@Megatokio

This comment has been minimized.

Show comment
Hide comment
@Megatokio

Megatokio Dec 4, 2013

This should be fixed quickly or there should be an easy-to-see and easy-to-find hint to all OSX users because waiting weeks for syncing the block chain will make most people abandon bitcoin-qt.

I'm waiting for the catchup to happen now for 2 weeks, on a desktop 2x3GHz iMac, and it was, until disabling AppNap, catching up 10-20 days/day (May/Jun '13). I'm pretty patient, but bitcoin-qt blocks a lot of ram while living.

But even with AppNap disabled it's now slow again, after starting with some speed, and its neither the cpu (<5%) nor adsl/internet (<1%). hm.. i'll see tomorrow...

Megatokio commented Dec 4, 2013

This should be fixed quickly or there should be an easy-to-see and easy-to-find hint to all OSX users because waiting weeks for syncing the block chain will make most people abandon bitcoin-qt.

I'm waiting for the catchup to happen now for 2 weeks, on a desktop 2x3GHz iMac, and it was, until disabling AppNap, catching up 10-20 days/day (May/Jun '13). I'm pretty patient, but bitcoin-qt blocks a lot of ram while living.

But even with AppNap disabled it's now slow again, after starting with some speed, and its neither the cpu (<5%) nor adsl/internet (<1%). hm.. i'll see tomorrow...

@tom-seddon

This comment has been minimized.

Show comment
Hide comment
@tom-seddon

tom-seddon Dec 31, 2013

I've found this a bit annoying too. Left bitcoin-qt running overnight; came back in the morning to find it had done... pretty much nothing.

Regarding laptops and their battery time, I don't understand the problem. My laptop has a plug - is it so unusual? (That's a rhetorical question by the way.) I'd suggest that this should be supported, even if it's just with a note in the readme.

Thanks,

--Tom

tom-seddon commented Dec 31, 2013

I've found this a bit annoying too. Left bitcoin-qt running overnight; came back in the morning to find it had done... pretty much nothing.

Regarding laptops and their battery time, I don't understand the problem. My laptop has a plug - is it so unusual? (That's a rhetorical question by the way.) I'd suggest that this should be supported, even if it's just with a note in the readme.

Thanks,

--Tom

@mikehearn

This comment has been minimized.

Show comment
Hide comment
@mikehearn

mikehearn Dec 31, 2013

Contributor

Leaving a laptop plugged in and switched on all the time would be unusual yes, that's why Apple don't optimise for that case. Even if you got caught up whilst the laptop was plugged in and running 24/7, the moment you closed the lid you'd start to fall behind again. Go on vacation? Be prepared for a long wait when you get back home before the app is usable again.

Contributor

mikehearn commented Dec 31, 2013

Leaving a laptop plugged in and switched on all the time would be unusual yes, that's why Apple don't optimise for that case. Even if you got caught up whilst the laptop was plugged in and running 24/7, the moment you closed the lid you'd start to fall behind again. Go on vacation? Be prepared for a long wait when you get back home before the app is usable again.

@gubatron

This comment has been minimized.

Show comment
Hide comment
@gubatron

gubatron Dec 31, 2013

Contributor

I hardly unplug mine, only when i go out. So I don't think it's unusual to
have it plugged.

http://twitter.com/gubatron

On Tue, Dec 31, 2013 at 8:09 AM, Mike Hearn notifications@github.comwrote:

Leaving a laptop plugged in and switched on all the time would be unusual
yes, that's why Apple don't optimise for that case. Even if you got caught
up whilst the laptop was plugged in and running 24/7, the moment you closed
the lid you'd start to fall behind again. Go on vacation? Be prepared for a
long wait when you get back home before the app is usable again.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3182#issuecomment-31394196
.

Contributor

gubatron commented Dec 31, 2013

I hardly unplug mine, only when i go out. So I don't think it's unusual to
have it plugged.

http://twitter.com/gubatron

On Tue, Dec 31, 2013 at 8:09 AM, Mike Hearn notifications@github.comwrote:

Leaving a laptop plugged in and switched on all the time would be unusual
yes, that's why Apple don't optimise for that case. Even if you got caught
up whilst the laptop was plugged in and running 24/7, the moment you closed
the lid you'd start to fall behind again. Go on vacation? Be prepared for a
long wait when you get back home before the app is usable again.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3182#issuecomment-31394196
.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Dec 29, 2014

Member

app nap was disabled in #5041 (thanks @jonasschnelli for bringing my attention to this)

Member

laanwj commented Dec 29, 2014

app nap was disabled in #5041 (thanks @jonasschnelli for bringing my attention to this)

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