Show HN: Plasmite – 재미있는 경량 IPC 시스템
hackernews
|
|
📦 오픈소스
#ipc
#plasmite
#경량화
#메시지 큐
#프로세스 통신
원문 출처: hackernews · Genesis Park에서 요약 및 분석
요약
프로세스 간 통신(IPC)의 복잡성을 줄이고자 설계된 경량화 도구인 Plasmite가 공개되었습니다. 이 시스템은 디스크에 지속되는 링� 버퍼 풀(Pool)을 사용하여 별도의 브로커 없이 JSON 메시지를 고속으로 전송하며, 시스템 충돌에도 안전하고 메시지를 재생할 수 있는 것이 특징입니다. 기존 카프카나 레디스 같은 메시지 브로커에 비해 구성이 간단하고 관리 부담이 적어, 로컬 통신 및 단일 호스트 환경에서 간편한 IPC를 구현하기 적합한 솔루션입니다.
본문
Easy interprocess communication. What would it take to make IPC pleasant and predictable? - Reading and writing processes come and go... so message channels should outlast them - Machines crash... so channels should persist on disk - Disks are finite... so channels should be bounded in size - Message brokers bring complexity and ceremony... so for local IPC, don't require a broker - Observability matters... so messages must be inspectable - Schemas are great... but schemas should be optional - Latency matters... so IPC should be fast, zero-copy wherever possible So, there's Plasmite. Plasmite is a CLI and library suite (Rust, Python, Go, Node, C) for sending and receiving JSON messages through persistent, disk-backed channels called "pools", which are ring buffers. There's no daemon or broker for local IPC, no fancy config, and it's fast (~60k 1KB msgs/sec writes, ~3M msgs/sec reads on a laptop). Readers mmap the pool file and walk frames in place, and payloads use Lite3, a zero-copy JSON binary encoding. For IPC across machines, pls serve exposes local pools securely, runs an MCP server, and serves a minimal web UI too. | Alice | Bob (a local reader) | |---|---| Alice creates a channel (aka a pool)pls pool create channel Alice sends a message pls feed channel '{"from": "A", "msg": "hello world"}' | Bob starts watching pls follow channel Bob sees it on stdout { "data": {"from": "A", "msg": "hello world"}, ... } | | Alice | Bob | Carol (remote) | |---|---|---| Alice runs pool serverpls serve init pls serve Alice sends pls feed channel '{"from": "A", "msg": "hi all"}' | (Bob never quit his follow process, so he's still watching the same pool.) Bob sees it { "data": {"from": "A", "msg": "hi all"}, ... } | Carol watches remotelypls follow http://alice:9700/channel Carol sees it { "data": {"from": "A", "msg": "hi all"}, ... } | The APIs work the same way as the CLI. | Drawbacks | Plasmite | | |---|---|---| | Kafka, RabbitMQ, | Lots of machinery: partitions, groups, exchanges, bindings, oh my. | Covers the 80/20 cases: no config, no broker, no partitions, no topology. | | Redis / NATS | Server required even for local messaging. Messages live in server memory; if the server dies, messaging stops. | Pools persist on disk independent of any process. Server only if you need one. | Log files / tail -f | Messages are unstructured. Logs grow and must be rotated (which breaks tail -f ). Can't easily replay from a specific point. No remote access without setting up syslog. | Messages have structure and sequence numbers. Disk usage is bounded. Replay from any point. Remote access is idiomatic. | | Ad-hoc files (temp files, locks, polled dirs) | Readers have to poll for new files. Locking is manual; crashes leave a stale lock. Files accumulate. No ordering unless you bake it into filenames. | Readers stream in real time. Writers append concurrently without explicit locks, and messages are ordered. Ring buffer bounds disk usage. | | SQLite as a queue | Readers have to poll. Writers contend. Have to design & migrate schemas. SQLite explicitly discourages network access to the DB file. | Follow & replay without polling. No SQLITE_BUSY . No schema, no migrations, no cleanup, easy remote access. | | OS primitives (pipes, sockets, shm) | Named pipes mean if the reader dies, the writer blocks or gets SIGPIPE. With sockets you have to implement your own framing and reconnection. Shared memory has to be coordinated with semaphores; be careful not to crash while holding a lock. Machine-local only. | Many readers, many writers, crash-safe, persistent across reboots. | | ZeroMQ | Messages vanish when processes restart. The pattern matrix is expressive but hard to get right. Binary protocol means you can't inspect messages with standard tools. | Messages persist. One mental model fits most cases. Plain JSON you can pipe through jq . | Use cases — CI gates, live event streams, duplex chat, system log ring buffers, replay & debug: see the Cookbook. Plasmite is for single-host and host-adjacent messaging. If you need multi-host cluster replication, schema registries, or workflow orchestration, see When Plasmite Isn't the Right Fit. brew install sandover/tap/plasmite Installs the CLI (plasmite + pls ) and the full SDK (libplasmite , C header, pkg-config). Go bindings link against this SDK, so install Homebrew first if using Go. cargo install plasmite # CLI only cargo add plasmite # use as a library in Rust projects uv tool install plasmite # standalone CLI + Python bindings uv add plasmite # add to a uv-managed project PyPI ships pre-built native bindings on macOS and Windows x86_64. On Linux today, prefer Homebrew or a GitHub release tarball for the system SDK; see the distribution docs for the current matrix. npm i -g plasmite Package includes pre-built native bindings. go get github.com/sandover/plasmite/bindings/go/local Bindings only (no CLI). Links against libplasmite via cgo, so first get the SDK via Homebrew on macOS, or from a GitH
Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.
공유