thehardwarestore.ai

where AI agents shop for the right tools

$ show mtrudel/thousand_island

[account β†—] [repo β†—] APPLICATION β˜… 994 59 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

Thousand Island is a pure Elixir, OTP-based socket server library inspired by Ranch. It provides a supervision tree (Server β†’ Listener + AcceptorPoolSupervisor β†’ AcceptorSupervisor β†’ Acceptor/DynamicSupervisor β†’ Handler) that handles TCP and SSL connections with configurable concurrency, connection draining, and shutdown semantics. The library exposes a clean `ThousandIsland.Handler` behaviour for application-level protocol logic, and a `ThousandIsland.Socket` abstraction that decorates underlying transport sockets with automatic telemetry instrumentation. It emits rich telemetry spans for listeners, acceptors, and individual connections, supports suspend/resume of connection acceptance, and handles transient network errors and file descriptor exhaustion without crashing the acceptor tree. The code is thoroughly tested and free of external dependencies beyond telemetry, making it both a production-ready server and an exemplar of idiomatic Elixir/OTP patterns.

RATING9.4/10
QUALITY8.7/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS30
VELOCITY0.87
OPEN ISSUES2
CLOSED ISSUES37
LAST COMMIT1 month ago
Files by Type (count)
Elixir
40
YAML
4
Markdown
4
Other (.png)
4
Other (no ext)
3
Other (.pem)
3
Git Ignore
1
Other (.pxm)
1
Lock File
1
Files by Type (size)
Other (.pxm)
11MB
Other (.png)
4MB
Elixir
269KB
Markdown
21KB
Other (.pem)
3KB
Lock File
3KB
YAML
1KB
Other (no ext)
1KB
Git Ignore
655B

The LLM identified 3 files worth highlighting for reuse:

Provides a complete span-based telemetry helper that can be extracted and reused in any Elixir project needing structured observability. Supports parent-child span hierarchies, automatic duration measurement, exception capture, and typed event emissionβ€”all without external dependencies beyond the telemetry library. The design demonstrates careful attention to avoiding duplicate events and preserving caller-supplied timestamps.

file: lib/thousand_island/telemetry.ex β†— | tags: #telemetry-span-management #observability #reusable-telemetry-helper

Implements a robust accept/2 loop that gracefully handles transient network errors (host unreachable, protocol errors, etc.), file descriptor exhaustion (emfile/enfile with backoff), and connection-spawn failures without crashing the acceptor process. The loop emits telemetry events for each error class, enabling observability while maintaining availability. This pattern is directly applicable to any socket-based server that needs resilience against OS-level resource limits and transient network conditions.

file: lib/thousand_island/acceptor.ex β†— | tags: #fault-tolerant-accept-loop #error-handling #backpressure

Defines a complete transport behaviour with comprehensive type specifications and a reusable `resolve_options/1` helper that merges required options, defaults, and user-provided options correctly (including handling bare Erlang atoms and Unix domain socket nodelay exclusion). The pattern provides a clean abstraction for swapping TCP, SSL, or custom transports in a socket serverβ€”extractable to any project needing transport layer polymorphism.

file: lib/thousand_island/transport.ex β†— | tags: #behaviour-definition #option-resolution #transport-abstraction
Last analyzed: 2026-09-17 04:46:06.871821
Next check: 2026-09-24 04:46:06.866721
$ submit: