April 11, 2025
Shiny ExtendedTask
& mirai
integration
Distributed computing
with mirai
to scale Shiny
mirai
is the ideal async counterpart for Shiny ExtendedTaskAspect | mirai | future |
---|---|---|
Core purpose | Async evaluation | Parallel processing |
Always non-blocking | ✔ | ✘ (✔ future_promise ) |
Event-driven | ✔ | ✘ |
Feels like* | reactive |
observer |
* Not technically equivalent, but intuitive analogies
Function | mirai | future |
---|---|---|
Create async task | mirai() |
future_promise() |
Set up local background processes | daemons(6) |
plan(multisession, workers = 6) |
ExtendedTask
🧠 Run in background
Offload heavy tasks — compute, I/O, APIs
🚦 UI stays responsive
No session blocking
📊 Serve more users
Fewer duplicated processes, higher scalability
🔌 mirai
efficiency
Lowers hurdle to using ExtendedTask
mirai
Work?📡️️ daemons(url = local_url())
Opens a local IPC socket
e.g. "abstract://85de9c..."
🛰️️ launch_local()
Launches 1 local daemon
daemons(6)
📡️️ daemons(url = host_url())
Opens a TCP network socket
e.g. "tcp://myhostname:40491"
launch_remote()
Shows shell command to connect
🛰️launch_remote(remote = ssh_config("ssh://192.168.0.10"))
Launches 1 remote daemon
daemons(6, url = host_url(), remote = ssh_config("ssh://192.168.0.10"))
🔐 SSH tunnelling allows the remote machine to connect back to your network socket as if it were local to that machine
See these slides at https://shikokuchuo-shinyconf2025.share.connect.posit.cloud