Notes from the Node.js VM Summit
The Chakra team was delighted to host the third Node.js VM Summit recently here at Microsoft. These meetings bring together JavaScript VM vendors, Node collaborators, and CTC members including participants from Google, IBM, Intel, Microsoft, nearForm, and NodeSource. This group is currently focused on addressing ABI compatibility problems facing the Node native module ecosystem. Today, we’d like to share a quick recap of the meeting and some of the next steps.
Node Native Modules
Node native modules are written in C/C++ and directly depend on V8 and/or NAN APIs. These modules may need to be updated or re-compiled for every major Node.js release because of ABI/API changes. This adds to the maintenance burden for native module authors and it presents barrier to upgrading Node versions in production deployments for module consumers. The first half of the session included presentations from the two complimentary projects intended to help with this: Fast FFI (foreign function interface) and N-API (Node.js API).
Fast FFI
Fast FFI aims to automatically project native APIs into JavaScript which will allow module authors to expose existing native code to Node.js without having to write additional C/C++ code. The FFI presentation discussed its architecture and use cases. Currently, this project is in its early stages of prototyping and more work is required for it to be considered as a Node.js feature. We will update the community as we make progress and keep evaluating its readiness.
N-API
N-API provides an ABI-stable abstraction layer for native APIs in JavaScript VMs. This helps native module authors compile their module once per platform and architecture and run it on any N-API compliant version of Node.js. The N-API presentation included a demonstration of some ported modules and performance comparisons with their V8/NAN equivalents. N-API has made great progress over the last year and now it is ready for broader usage and feedback. As reflected in the graph below which shows native API usage pattern among top 30 depended-on modules, we have 100% N-API coverage for V8 APIs used in 5 or more modules. The core team has successfully ported Node-Sass, Canvas, LevelDown, Nanomsg and IoTivity to use N-API.
VM Summit attendees evaluated the progress and readiness of both projects, and agreed to consider a pull request to include N-API in Node 8.0 as an experimental feature making it easier for native module authors to try out N-API and enable the team to test it broadly and get more feedback. The Fast FFI project will continue to evolve and may be included in a future Node.js release.
Key next steps for N-API project:
- Submit N-API Pull Request to Node.js master to be included in Node.js 8.0
- After stabilization, port it to Node.js v6.9 LTS and Node-ChakraCore
- Broader community engagement to identify API gaps
- Performance fine tuning
Other topics:
In the second half of the session the discussion focused on other VM compatibility topics including compatibility of the Inspector Protocol for debugging and baseline conformance requirements for Node.js VMs. The attendees also agreed on meeting again around NodeSummit later this year and evaluate progress on Fast FFI, N-API adoption, feedback and next steps.
It was very a successful and productive VM Summit, and we look forward to feedback on the forthcoming N-API PR. You can review the full recording of the session here, review the raw notes from the meeting, or take an take an early look early look at the API here, Thanks to all the attendees for making the VM Summit awesome!
― Arunesh Chandra, Senior Program Manager, Chakra
Source: Notes from the Node.js VM Summit
Leave a Reply