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
Progressively slower performance and high cpu usage #205
Comments
Though strange that it's not been reported before (or perhaps it has...). I assume you're seeing this same behaviour on a simple node process like: require('http').createServer(function (res, res) {
res.end('Hello');
}).listen(8000); |
I wouldn't assume that, but I guess it could be automated to test by having a script that writes test.js every 10 seconds or so and seeing what happens. In my case it is 100% replicable - at all times the restarts get slower and slower and eventually the node process is at 100%, but I haven't confirmed it is the nodemon process or the app. Let me get back to you when I've got time to look at it in depth. |
I am intermittently experiencing this on OS X; with long running processes |
I'm not able to replicate this yet. I usually have a nodemon process running jsbin for dev - admittedly this example is only a few days old (4 days) but I've had much longer and it doesn't affect cpu:
@tlvince do you have a sample app that you can see this 100% cpu issue? |
I've got a feeling this might be related to the number of files being processed. I've made a change to the latest dev version of nodemon that might mitigate this issue (if it's indeed linked to the file number). Any chance you can run the following command in the directory you normally run nodemon from?
And paste the result here? |
8781, it's a lot. I was also thinking there may be a watcher leak on each restart. |
I guess that wasn't directed at me, but I hope whatever you're looking at would apply to Windows as well. |
@remy, that sounds plausible: ❯ find . | wc -l
44127 (Don't ask 😄) |
Tom you win J |
Okay, so my gut feeling is that there's a lot of node_module dependancies (or deps of deps). If you're on linux, then this will go away. On mac we use |
Would this be mitigated through the use of |
@tlvince can you run your find again without node_modules I'm not sure applying fs.watch and creating a new event listener for potentially 44K files is going to be perform better. Which was why nodemon was always using unix |
Sure!: ❯ find . | grep -v node_modules | wc -l
8310
|
nodemon is ignoring That's still pretty high... Can you replicate the CPU issue? If you can, can you install the current dev version ( |
Just butting in to tell I'm experiencing the same issue. CPU caps at 94% though, 100% of the time. |
My grunt output from the
|
Here's my nodemon@dev -V output if it helps. |
Can you test outside of grunt, just to reduce the number of variables. Do On Sunday, December 15, 2013, Tom Vincent wrote:
— Remy |
Sorry - to clarify: @yoshuawuyts can you take grunt out of the picture. You've got the dev version install, but because you're using grunt-nodemon it's got it's own dependancy, so you're still on the old one. Can you remove grunt entirely from the test since you're able to consistently reproduce the issue. @tlvince is that all that's causing your high cpu usage? |
I've run a few tests, and it seems that disabling |
@yoshuawuyts do you know why you were using |
Since I'm using Windows and your docs state that |
@yoshuawuyts actually |
@remy, Yes.
The |
@remy I got it from the README. No echo's or anything :) |
@tlvince and this in off the directory that contains 44,000+ files, right? |
@remy correct. |
@tlvince so we need to run a find command that doesn't blow up your cpu. This'll be interesting :) |
@tlvince can you tell me how this performs - though I'm not even 100% sure of the
Obviously you'll need to touch a file that you normally save right before running this command (or 115 seconds before running this command). How does that perform? |
That one doesn't give any noticeable improvement; it hovers around 90%. How about leveraging Spotlight? The following will print files modified in the last second and it's lightning quick:
|
But only works for mac users and mac users that have spotlight enabled (I'm a mac user with spotlight disabled). Hmmm. This is a pain (still looking at it - whilst also looking at Windows issues in the new code) |
@tlvince can you try:
|
|
Right, we have two "issues" here.
I believe nodemon@1.0.0 has fixed the progressively slow perf (1) because I found that the monitoring list was getting continuously larger and larger - something that's fixed now. If you had this issue, can you upgrade to the latest and let me know if I need to re-open this issue. High CPU (2) due to 50,000+ files being monitored, I'm going to have to have to suggest maybe there's too many files being monitored. I can push the cpu down by using |
@remy, that's a sensible decision. The offending project (containing ~50k files) is an outlier and I don't think there's much that can be done (in a robust way) to alleviate the CPU usage. I've tried a few nodemon alternatives (run, supervisor) on this project and they both struggle in the same way. I did consider suggesting adding some tests to see if Spotlight is available and enabled, but didn't look into the details, and as you say, we should avoid bespoke solutions, although it might be worth looking into if this comes up again. |
@tlvince just as a heads up, I've modified nodemon@1.0.12 to include a warning when there's a large number of files being monitored. It's not much, but it'll certainly flag up any accidental watch. |
Installed 1.0.3 on Windows 7x64 and now relatively high fluctuating cpu usage (always between 10->60% on one CPU) for the same large project. With 0.9.x I just had the slow down but little to no cpu usage on monitoring, with increasing slowness over time for restarts. |
Simple node program: require('http').createServer(function (res, res) { |
@crussell42 run from an empty directory and no global config? |
Not sure on global config, I am a noob to node but this is just a empty dir var http = require('http');
On Wed, Feb 19, 2014 at 10:55 AM, Remy Sharp notifications@github.comwrote:
|
If this would help you debug something, I can downgrade back to 10.25 and On Wed, Feb 19, 2014 at 11:13 AM, Chris Russell crussell42@gmail.comwrote:
|
Just to let you know, the CPU spike does occur in version 0.10.26 but Intrestingly: So looks like an emacs issue, sorry for the disturbance and thanks for On Wed, Feb 19, 2014 at 11:23 AM, Chris Russell crussell42@gmail.comwrote:
|
I want to note that this issue also occurs when starting the process from upstart for some reason. I don't think we can make any claims that nodemon is suitable as an actual daemon in any sort of production capacity. I'm seeing load averages of 2400 or higher, absolutely crippling. |
I'm certain that I've never recommended nodemon for production. In fact, nodemon is squarely a development tool.
|
There is a 'leak' in likely the watching process - every time the process is restarted after a write, cpu utilisation increases until it is at 100% and I have to restart nodemon completely.
I don't have time in the short term to spend on this, but surely I'm not the only one experiencing it.
Win7 x64, node 0.8.x -> 0.10.x e.g. always been happening.
The text was updated successfully, but these errors were encountered: