High CPU usage while running on OS X
See original GitHub issueAfter running npm start
, the node
process consumes ~40% CPU on my machine:
![activity_monitor__all_processes_](https://cloud.githubusercontent.com/assets/505704/17265898/e44f896c-55c0-11e6-81f1-3b34e08bfbd0.png)
I found that setting a polling interval in the the WebpackDevServer helped:
new WebpackDevServer(compiler, {
historyApiFallback: true,
hot: true, // Note: only CSS is currently hot reloaded
publicPath: config.output.publicPath,
quiet: true,
// added this:
watchOptions: {
poll: 1000
}
})
Here were the settings I tried, and the resulting CPU usage:
poll: 1000 => 4-6% CPU
poll: 500 => 8-10% CPU
poll: 250 => 14-16% CPU
There’s a tradeoff between CPU usage and how snappy the dev experience feels. To me, 1000ms felt sluggish, but 500ms felt pretty good. I couldn’t discern much difference between 500ms and 250ms.
It seems like adding some kind of polling interval would be a good idea to reduce the CPU usage.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:31 (15 by maintainers)
Top Results From Across the Web
5 Ways to Fix High CPU Usage on macOS - MakeUseOf
5 Ways to Fix High CPU Usage on macOS · 1. Update Software and Restart Your Mac · 2. Use Activity Monitor to...
Read more >How to lower CPU usage on Mac - Setapp
Find out how you can control CPU usage on your Mac at any time by optimizing and quitting unnecessary processes.
Read more >How to reduce CPU usage on Mac - CleanMyMac X
High CPU usage on your Mac means your system will slow down and suffer from decreased performance; we've got all the troubleshooting tips ......
Read more >high cpu usage even without apps running - Apple Community
The system is using a very high percentage of the CPU. The bar graph shows mostly red, indicating that system processes (rather than...
Read more >How to Fix High CPU Usage on macOS 10.15 Catalina
Sometimes, when macOS 10.15 receives updates, especially security updates, it may result in high CPU usage. This update not only slows down your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing then. If you’re having issues, try:
node_modules
react-scripts
to the latest version inpackage.json
(make sure you follow the migration instructions in changelog for every release you’re skipping)npm i -g npm@latest
) or Yarn (yarn self-update
)npm install
(oryarn
)Can confirm here.
I updated from node 6.8.1 to node 7.1.0 yesterday and now the
node
process consumes 100% CPU on my machine.I didn’t find anything relative to CPU usage and node 7 in Webpack issues.
I’m on El Capitan + latest version of CRA.
@gaearon @dceddia Should we reopen the issue or create a new one?
Edit: For those who have the same problem, you can downgrade with
brew switch node x.x.x
and list all the versions installed withbrew info node
.