Does this allow FBP in JavaScript (serverside)?

65 views
Skip to first unread message

Ruud Steltenpool

unread,
Oct 19, 2017, 8:11:10 AM10/19/17
to Flow Based Programming
I don't understand all this, but you smart people probably do: https://github.com/Microsoft/napajs
Maybe it's a new place to have FBP working on?

My holy grail is FBP (because of modeling ease; the world is parallel after all; often more important than specific language) running in a webbrowser (most people won't do more than click a link nowadays, or know how to, on whatever device)
If we can get this on the server, then maybe also on the browser? Or do any of WebAssembly (wasm) / emscripten / other lower level options already make it possible ?


Henri Bergius

unread,
Oct 19, 2017, 8:41:27 AM10/19/17
to flow-based-...@googlegroups.com
Hi,

On Thu 19. Oct 2017 at 14:11, Ruud Steltenpool <goo...@steltenpower.com> wrote:
My holy grail is FBP (because of modeling ease; the world is parallel after all; often more important than specific language) running in a webbrowser (most people won't do more than click a link nowadays, or know how to, on whatever device)
If we can get this on the server, then maybe also on the browser? Or do any of WebAssembly (wasm) / emscripten / other lower level options already make it possible ?

At least in theory you should be able to compile an existing FBP system to wasm, especially now that all major browsers and Node.js support WebAssembly. However, the downsides are the pretty hefty performance penalty of invoking wasm functions, and the difficulty of non-trivial interactions between WebAssembly and JS. Both of these are likely to see improvements once WebAssembly gets more mileage.

If you want to do FBP in JavaScript right now, the most pragmatic option is using NoFlo (https://noflojs.org). NoFlo works in both browsers and Node.js, and has years of production usage behind it. The new functionality shipped in 0.8, and the removal of deprecated old APIs in the upcoming 1.x release bring it a lot closer to "classical" FBP.

Another server-side JavaScript FBP option is MsgFlo where each FBP node is represented by its own process (Node.js, Python, Rust, Arduino, whatever). But this of course involves a bit more setup than just "npm install". The msgflo-project template gives a good starting point, and ready-made Docker configuration to get it going: https://github.com/msgflo/msgflo-project

/Henri

Ruud Steltenpool

unread,
Oct 20, 2017, 3:37:55 PM10/20/17
to Flow Based Programming
Thanks for all that, I'll try one or more suggestions.
Which of the mentioned solutions (can) use multiple cores?

Ruud 

Henri Bergius

unread,
Oct 20, 2017, 4:00:54 PM10/20/17
to flow-based-...@googlegroups.com
Hi,

On Fri 20. Oct 2017 at 21:38, Ruud Steltenpool <goo...@steltenpower.com> wrote:
Thanks for all that, I'll try one or more suggestions.
Which of the mentioned solutions (can) use multiple cores?

MsgFlo does by default, though there are some ways to "bundle" multiple FBP nodes into a single process.

With NoFlo, the graph's data flow is bound by standard JavaScript event loop, but any asynchronous work done by individual components (for example, all I/O by default) happens in separate threads. There are also tricks like noflo-runtime "RemoteSubgraph" to move particular nodes to separate processes, or even computers.

But for real multi-core or networked FBP, I'd definitely recommend MsgFlo.

Ruud 

/Henri
Reply all
Reply to author
Forward
0 new messages