Skip to content

elixir: convert DirtyIo nifs to use message passing for asynchronous responses#172

Draft
npry wants to merge 2 commits intomainfrom
npry/ex.async-msg
Draft

elixir: convert DirtyIo nifs to use message passing for asynchronous responses#172
npry wants to merge 2 commits intomainfrom
npry/ex.async-msg

Conversation

@npry
Copy link
Copy Markdown
Collaborator

@npry npry commented May 7, 2026

DirtyIo NIFs are thread-pooled by the BEAM behind the scenes, and though the pool is configurable, this approach can limit throughput in highly concurrent scenarios. This is an alternate approach that offloads the synchronization to message passing using elixir's Task abstraction (slightly cleaner interface around processes) and a helper macro that handles destructuring the response message and waiting for the task

@npry npry force-pushed the npry/ex.async-msg branch from c3564ec to a804526 Compare May 7, 2026 20:03
npry added 2 commits May 7, 2026 16:21
Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: Ibdfa3c10dd50379a43b52a07c1a713cd6a6a6964
Potentially-blocking Rust-side calls now use message passing to respond
to the caller. Elixir now has `Tailscale.Util.await`, which spawns a
task that listens for the relevant response.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: Iafe01153ca52b9f618c80666de5e6f186a6a6964
@npry npry force-pushed the npry/ex.async-msg branch from a804526 to da42124 Compare May 7, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant