Do you know if Elixir implements non blocking i/o like NodeJS or Ruby EventMachine?Is there wasted CPU cycle waiting for http or database calls to response? Or does it put the process to sleep and wake it up when the data is ready?
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/5e556f48-53e9-48a0-a31d-28bc408370ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/e2fecc02-2b9a-44cc-9160-3fe97bfd3567%40googlegroups.com.
Do you know if Elixir implements non blocking i/o like NodeJS or Ruby EventMachine?Is there wasted CPU cycle waiting for http or database calls to response? Or does it put the process to sleep and wake it up when the data is ready?
--
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/CAGnRm4L-wC%2Brb4poXyf5M3DaEyygPvOpSr8_XtYCQ54A0dNGJg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/54FA32F9.4000202%40wildgooses.com.
Most Erlang io libraries are blocking by default.Additional effort is required to make io request in a nonblocking manner. See example: https://github.com/cmullaparthi/ibrowse#asynchronous-requests
Even though, the other processes are not blocked, but the scheduler still allocates CPU time to the supposedly suspended io process. I think this is where NodeJs has an advantage over Erlang.
Even though, the other processes are not blocked, but the scheduler still allocates CPU time to the supposedly suspended io process. I think this is where NodeJs has an advantage over Erlang.
This is not true. The Erlang VM has schedulers with run queues per core. Those queues are composed mostly of work to be performed either by running processes and I/O jobs. Once an Erlang process starts waiting for I/O, it no longer does any work, so no work will be put on the queue and therefore no scheduler will allocate work for that process.
I didn't think about it until now, but I guess the whole core of Erlang is really one large "select"?
The whole language really works by sending a message to some other process and waiting for a message back again? I presume that's how IO is actually implemented in Erlang, you send the operating system some message and the VM non-block waits on a response, waking up the caller once the response is delivered. So it's really a blocking API on top of an efficient green-thread vm!
Two notes:d
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/4598de48-de32-4335-abee-ddbe61d22b0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/561fb789-02ab-43a2-a5dd-acd88be2fb4d%40googlegroups.com.
Beautiful is
better than ugly,
Explicit is better than implicit,
Simple is better than complex,
Complex is better than complicated.
The Zen of Python, by Tim Peters