Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a node.js process running continuously on a linux EC2 instance, it extracts data and stores it in mysql. Some reads are also performed on the database.

The process can run well during hours or days, and have a steady RAM consumption. But from time to time it starts to consume more and more RAM, keeps increasing up to 100% of it causing the server to become unresponsive.

I first thought of a memory leak, but haven't managed to find anything.

Then I had a look at the I/O (using htop's "Detailed CPU time option"), and saw that there is a lot of Iowait (CPU bar remains filled in gray) at the same time when the RAM usage of the node.js process is increasing.

Is it correct to interpret that there is a correlation between the 100% RAM consumption problem and the I/O perf issue? Or should I go back to my memory leak investigation?

update: I have launched the same code, processing the same volume of data on a server from a different cloud provider. I don't have any peak of memory usage so far. I'm considering to switch to that provider and forget about that. Still curious to know what the cause of the problem could be. hardware ? some configuration?

share|improve this question

1 Answer 1

Is it correct to interpret that there is a correlation between the 100% RAM consumption problem and the I/O perf issue?

You have things backwards - the most likely scenario is that the memory contention is causing the high IO. When freeable RAM dwindles, pages start getting swapped to disk, which kills IO performance.

Or should I go back to my memory leak investigation?

Yep. One additional step you could take would be to move your swap to a separate spindle so it's not competing for IO with the rest of the server. That should only be a temporary band-aid solution, though.

share|improve this answer
    
ok, but why is the io-wait full before the RAM is fully consumed ? At the moment I see 1271MB of RAM consumed (3754MB available), and iowait is still completely filling the bar. Cache fills a large part of the available memor, about 15% of the RAM is totally free. about 300 MB of swap is used, for a reason I don't understand. –  mef Apr 3 at 19:37
1  
It could be either way. It's also possible that for some reason I/O performance drops, causing data to back up in RAM. –  David Schwartz Apr 6 at 16:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.