synadia-io / nex

The NATS execution engine
https://docs.nats.io/using-nats/nex
Apache License 2.0
190 stars 15 forks source link

Switch from Go native plugins to external binary plugins #363

Open autodidaddict opened 1 month ago

autodidaddict commented 1 month ago

Proposed change

Rather than loading dynamic libraries compiled only in Go (which therefore also prevents a plugin-enabled agent from being statically compiled), we should instead adopt the "plugins over stdio" pattern (or a similar variant), loading executable binaries and communicating with them via some transport contract.

Use case

This would allow plugins to be written in other languages than Go, taking advantage of different ecosystems for different workload types. Further, by no longer dynamically loading Go-based plugins, the agent wouldn't have to be statically compiled. Even further further, the agent wouldn't have to have dependencies like V8 (which has strict requirements as well as CGO issues) or WebAssembly. This leaves the agent slim, supporting only process execution for native and plugin-based workloads.

Contribution

No response

autodidaddict commented 1 month ago

I think a design that might make this pretty straightforward to implement might be as follows:

we're already pushing the plugin path down with the machine metadata, which means we can just reuse that.