I would like to execute some performance heavy tasks within an Elixir Phoenix application. Rather than sending the data elsewhere (external service), processing it, and returning it to the Phoenix app, I'd like to process it in place. Go has a lot of data science-y packages and so I'd like to use those within the Phoenix application. How can I do this?
I've researched and discovered Rustler (Rust) which uses NIFs. I could not find a Go variant or similar.
If you can, do not use NIFs, as panic in such code can cause your whole VM to crash. Instead BEAM has few different options for FFI:
erl_interface which is Port, but with some utilities for simplifying communicationUse System.cmd/3 to spawn the external Go process.
I frankly doubt there are any native bindings to Go available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With