highlight.js

Tuesday, March 30, 2021

Javet v0.8.0 with V8 and Node.js in JVM

I'm pleased to announce Javet v0.8.0 is released. Javet is an awesome way of embedding V8 and Node.js in Java.

The new release brings Node.js v14.16.0 + V8 v8.9.255😀

Now, Javet supports both Node.js mode and V8 mode both of which can co-exist in one JVM. In other words, they can run side by side and don't interfere with each other.

As the diagram shows, Javet loads V8 v8.9+ in the default classloader as an out-of-box solution. Node.js is lazy loaded in a custom classloader. Detailed comparisons are as following.

FeatureNode.js ModeV8 Mode
Built-inNoYes
CustomizationHighHigh
Node.js EcosystemCompleteNo
SecurityLowHigh
UnloadPotentially YesNo
V8 EcosystemCompleteComplete
V8 VersionLowHigh

One of the beauties of Javet is all the features in V8 mode can be applied to Node.js mode. Here are some examples.

  • Virtualization - All Node.js modules can be virtualized. E.g. consolefsHTTPNetOS, etc.
  • Zero-copy - JVM can share the same byte buffer with Node.js and V8 to achieve zero-copy.
  • Multi-threading - Multiple Java threads can host multiple Node.js runtime instances with only one copy of V8 objects visible to those instances.
  • Beyond Node.js - Javet allows explicit await() so that applications can take more control over async execution.



No comments:

Post a Comment

Cue Club 2 on Apple Silicon

It's been quite a long time for me not to play a decent snooker game since I replaced my Windows laptop with an Apple Silicon one. To be...