boazsegev /iodine
iodine - HTTP / WebSockets Server for Ruby with Pub/Sub support
★ 989⑂ 59👁 25⑃ 49● 122▤ 0
+0
Daily
989
stars
59
forks
25
watchers
49
prs
122
issues
0
releases
README
Iodine — a fast, C-powered server and client for Ruby
Try your existing Rack app on Iodine. Iodine includes built-in WebSockets, SSE, Pub/Sub, static files, TLS, and hot application restarts.
In a local three-trial benchmark, it delivered ~2.4× Puma's throughput at lower latency.
Keep Client I/O Moving While Ruby Works
Built on facil.io, Iodine runs Rack and NeoRack applications and includes an evented client for TCP, HTTP, WebSockets, and SSE.
Network I/O never waits on the Ruby GVL. Each worker handles client I/O in a dedicated C reactor thread outside the GVL. A separate pool of Ruby threads runs application code.
This separation lets one worker keep thousands of connections alive while Ruby code executes.
Iodine calls accept for new connections only when Ruby threads are available. This automatically routes new connections to the first available worker.
mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'fontSize': '20px', 'clusterBkg': 'fafafa', 'clusterBorder': '455a64', 'clusterTitleColor': '263238', 'titleColor': '263238'}, 'flowchart': { 'htmlLabels': true, 'curve': 'linear', 'padding': 24, 'nodeSpacing': 48, 'rankSpacing': 56 }}}%%
flowchart TB
subgraph Master["Master Process"]
MONITOR["Worker Monitoring"]
PUBSUB["Pub/Sub Postoffice"]
end
subgraph Worker["Worker(s) [0...N]"]
direction TB
subgraph ClientIO["IO/Reactor Thread"]
HTTP["HTTP"]
WS["WebSockets"]
SSE["SSE"]
MAILMAN["Pub/Sub Mailman"]
end
subgraph RubyBox["Ruby Threads / GVL"]
APP["Application Code"]
end
end
ClientIO ~~~ RubyBox
Master |IPC & Monitoring| Worker
ClientIO |callbacks| RubyBox
ClientIO |HTTP accept balancing| RubyBox
style Master fill:f3e5f5,stroke:6a1b9a,stroke-width:5px
style Worker fill:e3f2fd,stroke:1565c0,stroke-width:5px
style ClientIO fill:e3f2fd,stroke:1565c0,stroke-width:3px
style RubyBox fill:fff3e0,stroke:ef6c00,stroke-width:3px
classDef master fill:ffffff,stroke:6a1b9a,stroke-width:2px,color:4a148c
classDef io fill:ffffff,stroke:1565c0,stroke-width:2px,color:0d47a1
classDef ruby fill:ffffff,stroke:ef6c00,stroke-width:2px,color:e65100
class PUBSUB,MONITOR master
class HTTP,WS,SSE,MAILMAN io
class APP ruby
Install and Try Your App
Bundler-managed apps: add Iodine to your Gemfile. Keep your current server gem installed while you evaluate it:
ruby
Gemfile
gem "iodine", "~ 0.8"
bash
bundle install
bundle exec iodine
Iodine loads config.ru (or config.nru) from the current directory by default. It accepts THREADS and WORKERS environment variables.
Rails apps: if you use Puma, remove config/puma.rb or make its content conditional when switching servers. Iodine honors RAILS_MAX_THREADS and WEB_CONCURRENCY when not otherwise configured, so most Rails apps need no initializer.
Prefer command-line options and environment variables for code-free conTop issues
#66Feature Request: GraphQL Subscriptions Implementation26 comments · 2019-03-09#147Static file serving: allow mounting of multiple local dirs14 comments · 2023-07-26#100Sporadic segfaults13 comments · 2020-09-16#130The future of iodine (vs. plezi)...?9 comments · 2022-10-12#95Unstable TLS connection8 comments · 2020-06-18#164Potential issue with threads and database connections7 comments · 2026-02-03#146[FEAT] return reason for closed connection/client7 comments · 2023-07-07#94How to bind ssl cert with iodine + Rails?7 comments · 2020-05-20