Wrapping Up

There you have it. In this chapter, we explored three strategies for integrating external code:

  • Strategy 1: Native implemented functions (NIFs) allow developers to load code into the same memory space address as the Erlang VM. It is the most performant option but also potentially unstable and insecure. A crash on a NIF can bring the whole node down and long-running calls can cause the VM to misbehave, but dirty schedulers can mitigate some of the disadvantages.

  • Strategy 2: Ports run on the same machine as the Erlang VM node, but in a different process. They use I/O for communication. Ports are generally the best option to consider for integration, as it does not contain any of the safety implications behind NIFs nor the overhead behind ...

Get Adopting Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.