What if lightweight process model (like in Erlang) is used in paravirtualized sub-OS?-Collection of common programming errors
Handling network traffic inside a virtualized environment always causes problems with performance of the network input/output operations. See for example this post: Basecamp, now with more vroom
All incoming HTTP requests would need to be redirected by the host operating system into specific virtual machines. This would cause constant switching of context between these paravirtualized operating systems and additional overhead on network I/O operations.
Host OS receive a HTTP packet -> copy the packet to the VM's memory -> switch to the VM process -> inside the VM: receive the packet in the sub-OS network stack -> copy the packet to the receiving process (the web server) -> switch to the receiving process -> handle the request and return a response (with the same steps in reverse order)
This could be fine for the mentioned additional benefits but would require extra hardware to handle the same traffic when comparing to standard solutions.
In Erlang its Virtual Machine isn’t a separate operating system with its own network stack but instead is a standard process running on the hosting operating system natively. There is no overhead on IO network operations as they are all handled by the host OS.
Host OS receive a HTTP packet -> copy the packet to the Erlang VM's memory -> switch to the Erlang VM process -> handle the request and return a response