惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
G
Google Developers Blog
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
小众软件
小众软件
月光博客
月光博客
Recent Announcements
Recent Announcements
人人都是产品经理
人人都是产品经理
P
Proofpoint News Feed
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
The Cloudflare Blog
博客园_首页
美团技术团队
大猫的无限游戏
大猫的无限游戏
B
Blog
IT之家
IT之家
Jina AI
Jina AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - sumant1122/ringlog: A highly optimized, thread-p...
paperplanefl · 2026-05-22 · via Hacker News: Show HN

A highly-optimized, single-node, mini-Kafka broker built from scratch in Rust. This system leverages a thread-per-core architecture powered by io_uring via the tokio-uring framework, bypassing traditional OS thread context switches and synchronization overhead.


⚡ Key Architectural Features

  1. io_uring Asynchronous System Calls: Uses direct Linux kernel ring buffers for both Disk WAL I/O (File::write_at/File::read_at) and network I/O (TcpStream::read/TcpStream::write).
  2. Kernel-User Ownership Passing: Implements strict data ownership transfer where memory buffers (Vec<u8>) are passed to the kernel and reaped asynchronously, achieving zero-copy properties.
  3. Single-Thread Hot Path: The server runs entirely inside a single CPU thread event loop. Cross-client synchronization and tail-log notifications are achieved using thread-local asynchronous coordination (tokio::sync::watch and tokio::sync::Mutex), avoiding standard thread-locking contention.
  4. Append-Only Write-Ahead Log (WAL): Messages are sequentially packed with a 4-byte length header and flushed directly to disk.

📊 Wire Protocol Specifications

The broker communicates over TCP using a simplified binary framing protocol:

1. Connection Handshake

On initial connection, a client must send a single byte designating its role:

  • 0x01: Producer Client
  • 0x02: Consumer Client

2. Producer Protocol

Once handshaking as a Producer, the client continuously streams records:

  • Request Format: [4-Byte Big-Endian Length] [Payload Bytes]
  • Response ACK: The server appends the record to the WAL and immediately returns an [8-Byte Big-Endian Physical Offset] representing the exact byte location of the message.

3. Consumer Protocol

Once handshaking as a Consumer, the client requests a stream of records starting from a specific point:

  • Request Format: [8-Byte Big-Endian Starting Offset]
  • Response Stream: The server tails the WAL and streams back matches: [4-Byte Big-Endian Length] [Payload Bytes]. When it reaches the end of the log, it yields and awaits notifications of new writes.

🛠️ Prerequisites

  • OS: Linux (Kernel 5.1 or newer is required for basic io_uring support, 5.6+ is highly recommended for full socket support).
  • Rust: Modern stable toolchain (edition = "2021").

🚀 How to Run

The single binary supports four distinct operational modes via command-line arguments.

📦 Compiling and Running the Release Binary (Recommended)

To build the highly-optimized release binary:

cargo build --release

This produces a standalone executable at ./target/release/ringlog. You can copy this binary and run it anywhere on a compatible Linux environment:

# To run the self-contained simulation demo:
./target/release/ringlog

# To run the standalone broker server:
./target/release/ringlog server

# To run the interactive producer client:
./target/release/ringlog producer

# To run the real-time consumer client starting from physical offset 0:
./target/release/ringlog consumer 0

🛠️ Running with Cargo (Development)

For quick development and testing, you can use cargo to compile and run:

1. Run the Real-Time Simulation Demo

This runs a fully self-contained simulation of the broker, producer, and consumer all running concurrently inside the same thread-local event loop:

cargo run

2. Run the Dedicated Broker Server

To start the standalone broker server listening on port 12000:

cargo run -- server

Creates/appends to a persistent file commit.log in your working directory, automatically preserving/restoring the write offsets.

3. Run the Interactive TCP Producer Client

In a new terminal window, connect to a running broker server and dynamically type messages to publish them to the WAL:

cargo run -- producer

Simply type your message in the console and hit Enter. The client will print the assigned physical byte offset ACK returned from the server.

4. Run the Real-Time TCP Consumer Client

In a new terminal window, connect to a running broker server to stream all historical and newly landing messages:

cargo run -- consumer [starting_offset]

If starting_offset is omitted, it defaults to 0 (replaying the entire log).