Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Rust Systems & Distributed Systems Project Ideas

Building distributed systems and low-level infrastructure in Rust is a fantastic way to master the borrow checker, highly concurrent async environments, and performance optimization. Below are six project ideas that tackle real-world engineering bottlenecks, complete with architectural considerations, the motivation for building them, and real-world open-source inspirations.


1. Paged-Memory Distributed Cache for Variable Sequences

The Concept: Instead of building a standard key-value store, build a specialized distributed cache designed to serve variable-length data streams without memory fragmentation. Data is written to the cache in dynamic chunks over time. Instead of relying on standard heap allocation (which fragments under this workload), your system pre-allocates a massive memory pool and assigns data into fixed-size "pages" or blocks. A centralized or distributed metadata index tracks which logical keys map to which physical blocks.

Architecture & Considerations:

  • Memory Management: Implement a custom memory allocator/manager over a contiguous byte array.
  • Networking: Use a gRPC interface (using tonic) to stream data in and out efficiently.
  • Distribution: Implement a consistent hashing ring to distribute requests across multiple cache nodes.

Inspiration & Open Source References:

  • vLLM (PagedAttention): While an LLM serving framework, its core innovation—managing key-value cache memory in fixed-size blocks to eliminate fragmentation—is exactly what this project aims to generalize as a distributed cache.
  • Twitter's Pelikan: A unified cache framework that aggressively focuses on reducing memory fragmentation and maximizing throughput.

Motivation / Why Pick This: This closely mimics the real-world memory management challenges found in high-performance AI infrastructure, specifically the mechanics of key-value cache optimization and serving architectures. It forces you to think deeply about memory layout, potentially touching unsafe Rust for performance, while balancing the async network boundary.


2. Consensus-Driven Fleet Task Scheduler

The Concept: Build a distributed control plane that guarantees tasks—like executing a bash script or triggering a package deployment—are run reliably across a fleet of worker nodes, even if the coordinator crashes mid-flight. A cluster of nodes uses the Raft consensus algorithm to maintain a replicated state machine of "Pending," "Running," and "Completed" tasks.

Architecture & Considerations:

  • Consensus: Use a crate like openraft or raft-rs (or implement a simplified Raft from scratch if you want the ultimate distributed systems challenge).
  • Communication: Worker nodes connect to the current Raft leader via TCP/mTLS to receive configuration payloads or deployment commands.
  • Semantics: Implement exactly-once execution semantics so a network partition doesn't cause a deployment to run twice on the same machine.

Inspiration & Open Source References:

  • HashiCorp Nomad: A highly available, distributed task scheduler that uses consensus to manage fleet-wide deployments.
  • etcd: While primarily a key-value store, its implementation of Raft is the gold standard for distributed configuration management and state replication.

Motivation / Why Pick This: Moving from a standalone CLI or centralized server script to a truly fault-tolerant, decentralized deployment platform is a classic distributed systems rite of passage. It teaches you how to handle network partitions, leader election, and state machine replication—the backbone of systems like Kubernetes or Consul.


3. Layer 4 Reverse Proxy with Lock-Free Dynamic Routing

The Concept: Build a high-throughput TCP load balancer that routes incoming traffic to a pool of backend servers, allowing the backend pool to be updated dynamically without dropping connections or acquiring expensive locks. A background thread continually health-checks the backends and updates the routing table.

Architecture & Considerations:

  • I/O Processing: Use tokio and explore io_uring (via tokio-uring) for high-performance, asynchronous I/O to minimize syscall overhead.
  • Concurrency: Implement a lock-free concurrent data structure (like RCU - Read-Copy-Update, or an atomic pointer swapping mechanism) for the routing table. This ensures the hot path (routing packets) never blocks waiting for the health-checker thread.

Inspiration & Open Source References:

  • Cloudflare Pingora: A Rust-based asynchronous network service framework and proxy that handles massive concurrency and dynamic routing updates safely.
  • Envoy Proxy: A high-performance C++ edge and service proxy that popularized dynamic configuration updates via xDS without dropping connections.

Motivation / Why Pick This: It bridges the gap between low-level concurrent data structures and high-performance network programming. It will test your ability to design systems that maximize thread-pool efficiency and minimize lock contention, which is critical for modern systems programming.


4. Embedded LSM-Tree Storage Engine with Async Compaction

The Concept: Build a persistent, embedded key-value store from scratch using a Log-Structured Merge-tree (LSM-tree) architecture. Instead of updating data in place, writes are appended to an in-memory structure (Memtable) and a Write-Ahead Log (WAL). When full, the Memtable is flushed to disk as an immutable Sorted String Table (SSTable). Background threads continuously merge and compact these files to reclaim space and optimize read performance.

Architecture & Considerations:

  • Data Structures: Build a concurrent skip-list or lock-free B-tree for the Memtable to allow lock-free point reads while writes are occurring.
  • Concurrency: Use a dedicated background thread pool (using rayon or custom thread management) for level-based compaction.
  • Disk I/O: Utilize direct I/O via io_uring or mmap for highly efficient file reads.

Inspiration & Open Source References:

  • RocksDB: The industry standard embedded database for key-value data, showcasing advanced LSM-tree implementation and tunable compaction strategies.
  • sled: A highly concurrent, lock-free embedded database written in Rust that explores similar B-tree and log-structured storage patterns.

Motivation / Why Pick This: This is a cornerstone of modern systems programming. It forces you to manage the friction between highly concurrent in-memory data structures and the harsh reality of disk I/O. You will gain deep experience with file descriptors, memory mapping, and designing lock-free data structures that don't block background maintenance tasks.


5. Distributed Sliding-Window Rate Limiter via Gossip Protocol

The Concept: Instead of relying on a centralized Redis cache to rate-limit API requests, build a cluster of independent rate-limiting edge nodes that synchronize their counters over the network. Each node handles incoming requests and increments local counters, continuously sharing their local states to prevent limit bypasses.

Architecture & Considerations:

  • Hot Path: Use a lock-free concurrent hash map (like dashmap or a custom atomic structure) to track high-throughput request counts with minimal contention.
  • Networking: Implement a UDP-based gossip protocol where nodes randomly select peers to exchange state updates.
  • Consistency: Utilize a CRDT (Conflict-free Replicated Data Type), such as a PN-Counter, to ensure eventual consistency across the cluster without locking.

Inspiration & Open Source References:

  • Mailgun Gubernator: A distributed rate-limiting microservice designed for high throughput and eventual consistency across clusters.
  • HashiCorp Serf: An excellent reference for implementing robust UDP-based gossip protocols for decentralized cluster membership and state propagation.

Motivation / Why Pick This: It is a masterclass in eventual consistency. You get to build a high-performance, lock-free hot path for request authorization, while wrestling with the realities of distributed systems—network jitter, packet loss, and merging conflicting states without a central coordinator.


6. Continuous Batching Resource Multiplexer

The Concept: Build a daemon that sits in front of a simulated, highly constrained, and expensive resource (like a mock GPU or a complex calculation engine) and optimizes throughput by dynamically batching incoming requests. It dynamically injects new requests into the execution pool the moment older requests finish, without waiting for the entire batch to complete.

Architecture & Considerations:

  • State Machine: Build an async tokio runtime managing a complex state machine for request lifecycles (Queued, Scheduled, Running, Yielding, Completed).
  • Scheduling: Implement a priority queue or ring buffer that the scheduler constantly evaluates to determine optimal packing.
  • IPC: Set up Inter-Process Communication (IPC) via Unix domain sockets or shared memory so local CLI clients can submit work to the daemon with near-zero latency.

Inspiration & Open Source References:

  • vLLM (Continuous Batching Scheduler): Pioneers the continuous batching approach for GPU workloads, proving that dynamically packing requests at the iteration level yields massive throughput gains.
  • NVIDIA Triton Inference Server: A robust multi-framework serving platform that implements dynamic batching to maximize hardware utilization.

Motivation / Why Pick This: This mimics the sophisticated batching and scheduling strategies used in modern high-performance inference servers. It tests your ability to write complex, non-blocking async state machines and will deeply improve your understanding of how to squeeze maximum utilization out of a single bottleneck.

About

A Collection of handcrafted Rust based educational projects, in the system programming and distributed systems space.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages