Skip to content
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

http: add bindings to GET / #901

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tynes
Copy link
Member

@tynes tynes commented Nov 3, 2019

Add bindings object to GET / HTTP endpoint. Users sometime experience extremely slow IBD without realizing that it is using the Javascript backend. d553f0a might be enough to prevent this problem from happening again, opening this for discussion.

@codecov-io
Copy link

Codecov Report

Merging #901 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #901      +/-   ##
==========================================
+ Coverage   61.72%   61.72%   +<.01%     
==========================================
  Files         155      155              
  Lines       26058    26059       +1     
==========================================
+ Hits        16085    16086       +1     
  Misses       9973     9973
Impacted Files Coverage Δ
lib/node/http.js 59.68% <100%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77d8804...7fc391e. Read the comment docs.

Copy link
Member

@pinheadmz pinheadmz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this after #729 ?

@@ -161,6 +162,10 @@ class HTTP extends Server {
adjusted: this.network.now(),
offset: this.network.time.offset
},
bindings: {
sha256: sha256.native === 2 ? 'native' : 'js',
secp256k1: secp256k1.native === 2 ? 'native' : 'js'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't there also be the nodejs backend?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't there also be the nodejs backend?

Good point. I was thinking JavaScript is JavaScript when I wrote this. From the last time that I looked at the code, the main difference between the node backend and the js backend was the usage of BigInt in the node backend but browsers also natively support BigInt these days. Ideally, there would be an integer <--> string mapping of these values in bcrypto

@tynes
Copy link
Member Author

tynes commented Nov 4, 2019

Thoughts

Was thinking about the viability of some sort of GET /stats endpoint that this could be added instead of adding it to GET / to prevent too much bloat on a single endpoint. GET / already does include a memory property, which under the hood calls process.memoryUsage

node.js has recently added process.resourceUsage which returns a very large object that corresponds to a uv_rusage_t but has some interesting data in it, in particular fsRead and fsWrite.

It looks like other node.js developers have attempted to build some tools that can get in depth stats of the event loop, but based on their conversation it isn't easy and there isn't much reliable open source code doing this. Its done by writing some native code that plugs into libuv hooks. The behavior also differs between versions of node.js

It seems like a closed source platform called N|Solid has implemented event loop metrics for their JavaScript runtime and they mentioned in one of the PRs above that it was not easy.


Conclusion

  • Adding the bindings property to GET / may or may not be useful
  • It may be viable to add a new method to blgr that calls process.getResourceUsage and formats the output into a smaller object to get better stats on the process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants