alexanderGugel / ied

:package: Like npm, but faster - an alternative package manager for Node
http://alexandergugel.github.io/ied
MIT License
1.99k stars 53 forks source link

Option to throttle install (to conserve memory) #125

Closed billiegoose closed 8 years ago

billiegoose commented 8 years ago

Hello! I love this project for many reasons. One of which is that after refactoring my app, I discovered that npm is horrible about using memory. I'm running my apps on small cloud servers with only 512MB RAM - my app runs fine, but the OS kills 'npm install' because it eats too much memory.

In contrast, ied not only uses much less memory, but the install runs 5 times faster. I attribute this to ied basically having a superior design. However, about 1 out of every 4 times I run the installer, it still gets killed for too much memory. I can only assume the difference is in the network - perhaps when NPM repository is slower more requests queue up and memory usage increases?

Anyway, my question is: how hard would it be to throttle the installer? And is that the best way to minimize memory consumption?

Addendum: Mostly asking in case you say "oh, that would be really hard! don't try that!". But if you think its easy I'll happily dive in and contribute the code my time permitting.

alexanderGugel commented 8 years ago

Good idea and fair point. Wanna give it a try?

How this would work:

billiegoose commented 8 years ago

Hmm, well I tried your suggestion, but I'm not sure if I got it to work. I tried adding a custom http.Agent but then needle complains for https requests. Then I tried modifying both http.globalAgent and https.globalAgent but it didn't seem to have any effect on memory usage. Plus, I just realized as I was doing this that version 2.x came out and I was still using version 1.x. Not sure how that will effect memory usage.

If 'ied install' starts to fail for me more frequently, you can bet I'll look into this again, but for now I've got more to work on my database performance... ah, devops.