5 ms·
IncludeOS roadmap: tiny Node.js-style web services in highly efficient C++
- std_throwaway 11y agoAt first it seemed strange that a Node.js-replacement needs a full IP stack including DHCP. As far as I understood this, they are building a whole operating system to be run in a VM like QEMU which then acts like a Node.js-instance - except that it's programmed in C++ and linked as one whole exeutable which also is a complete OS. I wonder how this compares to Docker or Sandstorm where the existing kernel API is used in a virtualized container instead of emulating a whole machine.
- deleted 11y ago[deleted]
- hanez 11y agoWhat they want to do is to implement the concept of a unikernel (https://en.wikipedia.org/wiki/Unikernel https://en.wikipedia.org/wiki/Unikernel). That's a very different approach then running a complete OS with their software stack on top. Take a look at the two links in my other comment.
- kentonv 11y ago> I wonder how this compares to Docker or Sandstorm where the existing kernel API is used in a virtualized container instead of emulating a whole machine. Short answer is probably: Better at security, but less efficient. Xen bugs notwithstanding, the VM boundary has a better security record than the kernel API boundary. (Though Sandstorm -- my project -- has been pretty successful at dodging kernel bugs through aggressive attack surface reduction.) The problem with VMs is that they're heavy-weight. The hardware interfaces were never intended to be a clean abstraction boundary between software. For example, it's tricky to reclaim unused RAM back from a VM, because within the VM the guest would by default assume it has a fixed amount of RAM that is exclusive to it. Communication probably has to happen in the form of network packets, requiring setting up and traversing a whole IP network stack in the guest, which is a lot more expensive (in both CPU time and memory use) than pipes, unix sockets, or shared memory would be. However, if you're designing a kernel specifically for use in a VM, you can probably do better on these things, e.g. you can define some virtual hardware interface by which the kernel marks RAM pages unused so that the host can take them back, or you can define a cleaner communication interface. But as you define these interfaces, your "virtual hardware API" ends up looking more and more like a kernel API -- and has greater risk of security bugs. So one way (containers) you start out with a wide interface and high efficiency but a large attack surface, and you try to narrow the interface to improve security. The other way (VMs) you start with a narrow but inefficient interface which you try to widen to improve performance. Eventually they will probably converge.
- Gladdyu 11y agoI wrote something similar a while ago, combining the easy-to-use asynchronous programming model of Node.js with the speed of C++. http://gladdy.github.io/c++/2015/07/26/NodeDemystified-pt1.html http://gladdy.github.io/c++/2015/07/26/NodeDemystified-pt1.h... source code: https://github.com/Gladdy/Mininode https://github.com/Gladdy/Mininode
- nickpsecurity 11y agoThe example looks really clean. Amazing how far modern C++ has gotten in that area.
- pcwalton 11y agoLosing memory safety is a pretty big deal though. In particular, the capturing semantics with [&] are going to result in a big surprise (use after free) if you try to close over and capture variables like you do with node.js.
- nickpsecurity 11y agoGot no expertise there. I always assume it with C or anything derived from it. But C++ commenters here keep telling me modern C++ and its libraries have all kinds of ways to prevent common issues with memory. They've demonstrated a few. So, I'd be curious to see a comparison of what happened in practice between the two. That said, typical C++ applications might be easier to get right than Javascript runtimes, JIT's, or whatever. A lot of eyes go into the JS foundations but so do a lot of complexity and problems.
- pcwalton 11y ago> That said, typical C++ applications might be easier to get right than Javascript runtimes, JIT's, or whatever. A lot of eyes go into the JS foundations but so do a lot of complexity and problems. It is untrue that typical JavaScript applications are vulnerable to anywhere near as many memory safety issues as C++ applications are. Even "modern C++". As a very relevant example, closures are modern C++, but neglecting the right annotation on the capture clause—the difference between writing one ampersand and not—can lead to use-after-free. In JavaScript, the runtime will manage the lifetimes of the closed-over variables for you, and you can't get it wrong unless there's a bug in the JS engine. Accidental use-after-free due to JS implementation bugs is so rare that I wouldn't be surprised if it's never happened in practice.
- smithclay 11y agoIf you're interested in IncludeOS, runtime.js is also worth checking out: http://runtimejs.org/ http://runtimejs.org/
- hanez 11y agoSounds a little bit crazy to me at first but when thinking about it, it is a nice idea. May you should take a look at Rump Kernels and build your stuff on top. Then you do not need to implement the OS stuff - It's done already. May I am wrong but it seems to be a similiar idea but the following project is currently at the OS level only but some applications like ngnix are working already. I was very confused when I first read about Rump Kernels and after reading a while and watching some conference talks a lot of stuff made sense to me even if I do not understand in detail what they are doing. http://rumpkernel.org/ http://rumpkernel.org/ https://github.com/rumpkernel https://github.com/rumpkernel
- semisight 11y agoThis seems more like MirageOS/Ling than a rumpkernel. From what I remember, rumpkernels are more general, at the cost of being less "unikernel-y" (i.e. lean and fast). I agree that it would be easier and faster to use a rumpkernel if the intention is use in production soon. I can't tell if this is a research project, or intended to be production quality at some point.
- vive-la-liberte 11y ago>I can't tell if this is a research project, or intended to be production quality at some point. Found this on their website [1]: >IncludeOS is the result of a research project at Oslo and Akershus University College of Applied Science (hioa.no) >IncludeOS is not production ready - but we're working hard to become so. [1]: http://www.includeos.org/ http://www.includeos.org/
- semisight 11y agoThanks, I didn't catch that. I'll have to make some time to play with this, especially once it gets further along.
- hanez 11y agoI believe to get this production ready will take some years. From what I understand in the projects FAQ page they want to implement the concept of a Unikernel and this is what the Rump Kernel at http://rumpkernel.org/ http://rumpkernel.org/ is intending too. May I am wrong because I am not to deep into it. If it is a research project then they should go on... It looks like it is because it is beeing developed at a university in Oslo, Norway. http://www.hioa.no/eng/ http://www.hioa.no/eng/
- jdc 11y agoAnyone know how this compares to OSv?
- BrainInAJar 11y agoSo... back to CGI programming then. Cool.
- kentonv 11y agoI like this idea, but I don't understand describing it as "node.js-style". I guess they think of Node as being a particularly ideal platform for implementing "microservices", but honestly I don't think there's any particular property of Node.js itself that makes it microservice-friendly. To me "Node.js" simply means "server-side Javascript", which obviously this isn't (it's C++).
- rileymat1 11y agoASP has had server-side "Javascript" for years. The magic sauce in Node.js is the combination of async, JS, and package management.
- TheRubyist 11y agoJust use Rust....
- ilaksh 11y agoI thought web assembly was going to be the main part of Node++. Anyway I would look into Nim or Go if you want a more efficient webserver.
- kator 11y agoI love watching the pendulum swing back and forth in tech. From mainframes to pc's ... to thin clients ... to server rendered HTML ... to client side frameworks ... to microservices I'm sure I could come up with more examples. I was just thinking of re-architecting a heavy apache web head app into unikernel super light micro services. It just makes me chuckle as we swing back and forth and try to find the right balance. Each generation sort of saying "Hey wait there's a CPU over here on this side of the diagram and it could do X/Y/Z". Recently I've been working on Raspberry Pi's so much that when I logged into a nice medium sized EC2 instance I was "shocked at how responsive these are". LOL. I started on machines with 4k of memory and built systems that consume TB of ram across many nodes and data centers. It's fun to go back to my roots trying to cram something into an ESP8266 nodemcu device and thinking about how long I can run it on a LiPo battery. I think this back and forth is good for us, but I encourage everyone to spend time on micro devices to remember just how simple you can solve a problem when confronted with the reality of 20k of ram and 4M of flash storage.
- alfanick 11y agoI never been fun of Node.js (neither the hype of writting server-side in awful JS), so sometime ago I've written https://github.com/alfanick/rest-cpp https://github.com/alfanick/rest-cpp - "tiny Rails-style web services in highly efficient C++" ;) Code has not been updating for some time, but it is near production-ready.