A minimalist, high-performance Rust web framework built with a zero-dependency philosophy for maximum speed and low memory footprint.
Why WebIO?
WebIO is a zero-dependency Rust web framework engineered for high performance, from real-time chat to intensive data science. Powered strictly by the Rust Standard Library, the engine prevents "event loop freeze" by ensuring heavy calculations never compromise general service responsiveness. The minimalist architecture utilizes dedicated OS threads for pre-emptive multitasking. Featuring a "Safe-Turbo" executor with a custom spin-loop for ultra-low latency and O(1) memory complexity for big data, WebIO delivers a high-integrity implementation for high-stakes environments.
Event Loop Blocking: Performance Bottlenecks
In traditional async runtimes, tasks must yield control voluntarily. If a single request performs a heavy calculation—such as a regression model, image processing, or a large CSV parse—the entire event loop thread is blocked. This freezes the server for all other concurrent connections, including lightweight API calls or WebSocket tasks.
WebIO Solution: Go-Inspired OS Pre-emption
WebIO utilizes raw OS Threads for true kernel-level isolation. Whether serving a lightweight API or a heavy-duty data model, the OS ensures every connection stays active.
- Go-Inspired Concurrency: A unique OS thread per connection ensures pre-emptive multitasking. A heavy mathematical calculation on one thread never "freezes" the server for others.
- Safe-Turbo Bridge: A specialized
block_onexecutor with a 150k-cycle spin-loop catches I/O states in nanoseconds, bypassing OS scheduler jitter for ultra-low latency. - Zero-RAM Big Data: Raw TcpStream access enables moving 100GB+ datasets in 64KB chunks, bypassing the 10MB RAM safety guard.
Production Ready: v1.0.0 Stable
WebIO is now a Stable Production Engine, moving beyond its initial research and development phase.
- API Stability: Starting with v1.0.0, WebIO follows strict semantic versioning. The core architecture and concurrency patterns are now locked for long-term stability.
- Legacy Research: Versions below 1.0.0 (0.9.x and earlier) represent the research phase and may contain breaking changes or unstable patterns.
- The Goal: To provide a high-integrity, zero-dependency core for high-performance web projects.
- Framework Foundation: Much like Tokio or Axum, WebIO is a powerful base for building specialized tools. It is designed to be the core foundation for the Fluxor Data Science framework and any other project requiring WebIO’s unique multi-threaded performance.
Performance Architecture
- Hybrid Spin-Wait Strategy: The
block_onexecutor uses a 150k-cycle spin-loop to catch I/O ready states in nanoseconds, maintaining sub-millisecond tail latency by bypassing OS scheduler jitter for "hot" tasks. - Smart RAM Cache: Transparently caches hot assets (<500KB) using an
RwLockto provide ~50µs RAM-speed delivery for CSS/JS/JSON, while large files stream safely from the Disk. - Zero-Dependency Integrity: By strictly avoiding external crates, WebIO is immune to "supply chain attacks" and remains a pure, high-performance core for Computing Science and Mathematical applications.
- Nagle Control: Granular builder-pattern control over TCP throughput vs. latency (set_nagle) optimizes for either real-time APIs or massive data syncs.
Core Philosophy
WebIO provides a fully functional web engine with zero external dependencies. By strictly utilizing the Rust std library, it ensures an ultra-light footprint, rapid compilation, and total memory predictability. zero external dependencies.
- No
tokio,async-stdorhyper. - No
serdeor heavy middleware bloat. - No
unsafecode in the executor. - Just pure, high-performance Rust.
Installation
To include webio in your Rust project, run:
cargo add webio
Or add webio to your Cargo.toml:
[]
= "MAJOR.MINOR.PATCH" # replace with the actual version
Quick Start
- Closure Pattern
use *;
- Handler Pattern
use *;
async
Example
The following example demonstrates a production-style implementation, utilizing dynamic routing, raw stream handling for massive datasets, and high-speed disk allocation.
use *;
use ;
use ;
/// Big Data Handler (O(1) Memory Complexity)
/// Method: POST -> http://localhost:8080/upload
async
Performance Snapshots
WebIO bypasses traditional abstraction layers to achieve raw hardware speeds. The following metrics were captured during 100MB and 1GB disk allocation operations:
🟢 100 Megabyte Stress-Test
Efficiently allocating 100,000,000 bytes and serializing a JSON response in under a quarter-second demonstrates the engine's low-latency agility. This benchmark highlights the minimal overhead required for mid-scale data ingestion.
Benchmark Result:
Status: 200 OK | Size: 64 Bytes | Time: 245 ms
🔵 1 Gigabyte Stress-Test (Peak Performance)
WebIO scalability reaches raw hardware limits. Processing 1,000,000,000 bytes in approximately 1 second with a fixed 64KB memory footprint ensures total system stability during massive data ingestion.
Benchmark Result:
Status: 200 OK | Size: 66 Bytes | Time: 1.03 s
This chart visually confirms the Perfect Linear Scaling of the WebIO engine. As the data volume grows from 1MB to 2GB, the execution time increases in a straight, predictable line, proving that the framework introduces no internal bottlenecks or "performance cliffs."
WebIO Performance Scaling Summary
| Data Volume | Time (ms) | Throughput | Engine Status |
|---|---|---|---|
| 1 MB | 154 ms | ~6.5 MB/s | 🟢 Low-latency Floor |
| 10 MB | 160 ms | ~62.5 MB/s | 🟢 High Ingestion |
| 100 MB | 245 ms | ~408 MB/s | 🔵 High Throughput |
| 1,000 MB (1GB) | 1,030 ms | ~970 MB/s | 🔥 Hardware Peak |
| 2,000 MB (2GB) | 2,000 ms | ~1,000 MB/s | 🚀 Turbo Saturation |
⚖️ License
WebIO is released under the MIT License.