Closed hiqsociety closed 3 years ago
Hi @hiqsociety. There is no such thing as a stupid question and these are all good ones! I'll get back to you later today on them.
- What kind of application is suitable for development on just-js? It tried to avoid allocation on heap? So how large an app can it be for performance to look "normal" for a js project?
Well, i think at the moment it is only suitable for experimentation and discussion. There is quite a bit of work to be done to get to an 0.1 release never mind 1.0. But the kind of things I can see it being useful for would be:
So, i think in general there is a certain subset of applications that are difficult to make work well in node.js due to the overhead of the platform itself and the fact that it makes it difficult to get at the low level primitives because of it's high level of abstraction.
- From my limited understanding of js / v8, basically this is using the underlying v8 to achieve performance, so is there a possibility to use DPDK / NIF kind of stuff to get more performance out of this?
Yes, DPDK and other userpsace networking solutions are definitely good candidates for this platform and something i would like to investigate myself.
- Can you mention the limitations of just-js? As in what function / features are not available and maybe some real world application suitability for development like a todo app or simple pwa kind of app on this?
If such performance is possible, I'm actually thinking of replacing luajit with just-js. Not sure if you think it's a good idea.
I think there is pretty good coverage of the system call interfaces you would need to do most things you would need to on linux right now. Still some work to do on organising the api's and putting some thought into which pieces of functionality belong in which module
It should also be pretty straightforward to add any missing functionality by writing your own C/C++ bindings or using the ffi bindings. i have got all the basic functionality of sqlite working with ffi and it is pretty fast compared to other platforms.
There are also module in various stages of development for rocksdb, postgres (c/c++ and js), http parsing so it should be pretty easy to put together a little demo http server with a database backend. I'll see if i can put something out there this week as i am working on the documentation.
Please bear with me while I catch up over next couple of weeks. The attention is a little unexpected but I am encouraged that others seem to be interested in the general idea.
With reference to the two below:
https://blog.cloudflare.com/cloud-computing-without-containers/ https://www.infoq.com/presentations/cloudflare-v8/
how does just-js compared with v8 isolates? are they the same? or just js is more lightweight?
With reference to the two below:
https://blog.cloudflare.com/cloud-computing-without-containers/ https://www.infoq.com/presentations/cloudflare-v8/
how does just-js compared with v8 isolates? are they the same? or just js is more lightweight?
Yes, cloudflare have been doing a lot of interesting work in this space. Edge computing is definitely something I would hope this could be useful for.
There's another good one from cloudflare here.
Each process in just has a v8 Isolate. If you spawn new threads you will also have a new v8 Isolate per thread. The overhead is quite small compared to a full process - only about 2MB per thread compared to 9-12 MB per process. The v8 model does not allow sharing of v8 Objects between Isolates without serialization but you can share buffers between Isolates on different threads using SharedArrayBuffer and also can do IPC over pipes.
It would also be possible to do something similar to cloudflare and have multiple isolates running on the same thread which you can enter and exit very quickly but I have not exposed any api to do that yet. Should not be very difficult and seems like something that would be good to have in core.
There are some examples in various states of disrepair here:
2MB per thread... is actually a lot. was wondering any ways to cut this down further to... 4kb and lesser?
2MB per thread... is actually a lot. was wondering any ways to cut this down further to... 4kb and lesser?
as far as i understand this is how v8 works. if you want a JS environment it is going to cost between 1-2MB on startup for each new isolate you create. if you just want to call out to some c++ code on a separate thread then you could have a smaller stack on each thread but wouldn't be able to run javascript.
i'll see if i can dig out something from the v8 blog that covers this.
running v8 is not going to possible on memory constrained environments like SBCs and microcontrollers if that is what you are thinking. there are other JS runtimes like duktape that work well for embedding but they don't have the performance advantages of v8.
First of all, very impressive results for javascript on techempower benchmark. Questions:
What kind of application is suitable for development on just-js? It tried to avoid allocation on heap? So how large an app can it be for performance to look "normal" for a js project?
From my limited understanding of js / v8, basically this is using the underlying v8 to achieve performance, so is there a possibility to use DPDK / NIF kind of stuff to get more performance out of this?
Can you mention the limitations of just-js? As in what function / features are not available and maybe some real world application suitability for development like a todo app or simple pwa kind of app on this?
If such performance is possible, I'm actually thinking of replacing luajit with just-js. Not sure if you think it's a good idea.