-
Notifications
You must be signed in to change notification settings - Fork 62
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
Make spawning super fast! #190
Conversation
@diasdavid @dryajov I'll try calling |
Codecov Report
@@ Coverage Diff @@
## master #190 +/- ##
=========================================
Coverage ? 87.67%
=========================================
Files ? 18
Lines ? 698
Branches ? 0
=========================================
Hits ? 612
Misses ? 86
Partials ? 0
Continue to review full report at Codecov.
|
It's now ~350ms/command.
|
@richardschneider historically, we had many issues with ipfs process spawning and killing, to the point that using In order to move away from subcomandante, we need to be extremely careful and test well that we don't end up in that world again. |
@diasdavid "Test well", does that mean that all tests run on all platforms? |
More than unit tests. I'm talking about linking it to apps like ipfs-desktop and using it in multiple platforms + run the js-ipfs-api tests with it to ensure that everything is running as expected. |
@diasdavid ran the Then tried running the tests in the browser and as you can guess I don't know about |
package.json
Outdated
"detect-node": "^2.0.3", | ||
"hapi": "^16.6.2", | ||
"hat": "0.0.3", | ||
"ipfs-api": "^17.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we keep this as a devDependency? We don't want to bundle this, in case the consuming project already defines their own version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that. It seems that npm install
just does that.
@richardschneider I wonder why such a performance bust? I'd imagine go being a bit lighter than node in general? |
@dryajov I beginning to feel that killing a I'm fighting other fires right now, so will eventually get back to this. |
@hacdias can you give a hand here? |
@diasdavid I've been waiting for I'll rebase real soon and continue my investigations. |
@richardschneider thank you :) |
@richardschneider wanna rebase now? |
@diasdavid I need graceful stop before rebasing. What does another week matter. |
@richardschneider time to rebase master onto this branch! :D |
I've ran this branch locally and got this results:
In comparison, master yields this:
|
I've rebased master onto this branch, here are my results:
|
This seems to work as expected. Should we go with it (I'm 👍)? @richardschneider if we merge this, lets not forget to remove subcomandante from the package.json deps |
@dryajov done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please take into account my comment above -- #190 (comment) -- simply trusting CI won't do it for this PR. |
@hacdias how can we test this with ipfs-desktop? |
TL;DR; - I think we need to look into this further to make sure we are handling things correctly and allowing gracefully shutdown across all platforms, while also being a friendly module to users consuming I believe it is generally frowned upon to listen to the main process signals in a library. The issue is that when listening on The It's a little dense and hard to parse, but the section on Signal Events provides some insight to how nodejs signals are handled. I think it's also important to note this line from the process docs with regard to windows
The standard Both nodejs and golang exit the process on a Side note of Windows
The I don't have a good solution to this at the moment, but I do think we need to dig a bit further to see if we can come up with a better solution. This thread (nodejs/node#12378) on the node project provides more insight as well, and is worth a read through. Signals in golang can also be read up on (https://golang.org/pkg/os/signal) here. |
@dryajov sorry. Completely missed this. Time elapsed from 'DaemonFactory.create().spawn(...' to 'node.start':
Don't forget that between the process of those two functions there are a lot more things going on on IPFS Desktop. Everything else seems to be working as expected. I'll leave IPFS Desktop running with this branch to see if I fall into any issues. |
Thanks @hacdias! |
I agree, we need to look into this further. I think that by removing the intermediate subcomandante process we fall back into the same issues subcomandante is trying to mitigate - namely forcefully killing ipfsd-ctl will leave a zombi ipfs process. We should definitely handle the |
I'm closing this PR given that the risk / speed tradeoff doesn't justify spending much more time into it right now. |
@dryajov Some details for #188
Well it was having a bad night, the 10s/command is now down to ~1.5s/command. It's still slow.
I'll be very interested in seeing what unix reports. To get these results, you need to set the environment variable, in windows its
set DEBUG=ipfsd-ctl*
. Thennpm run test:node
.