Distributed P2P System — Final Project

Overview

Designing a fully functional distributed system from scratch is a true test of engineering — not only of programming ability, but of systems thinking, architectural decision-making, and the ability to deliver a robust and scalable solution under real-world constraints. For this project, I set out to design and implement a peer-to-peer (P2P) file-sharing platform that goes far beyond classroom exercises: one that touches on real concurrency, network protocols, distributed state, automation, and reliability.

Concept & Motivation

The objective was to build a modular, maintainable, and efficient P2P system where multiple clients and servers interact seamlessly, providing decentralized file sharing, robust error handling, and transparent logging — all while ensuring the system remains responsive, secure, and easily extensible.

This experience challenged me to combine everything I had learned about systems programming, networking, process management, automation, and software engineering into a single, integrated platform.

Architecture & Core Features

  • Hybrid Technology Stack:
    • C: High-performance server and low-level networking.
    • Python: Automation, web services, and test orchestration.
  • Distributed Concurrency:
    • Thread-per-connection model for the server, with intelligent mutex management for efficient, race-condition-free operation.
    • Read/write mutexes to optimize concurrent access to shared state.
  • Dynamic Database:
    • In-memory, concurrent data structures model the distributed state, supporting rapid lookup, insertion, and removal for users and files.
  • RPC Logging:
    • Asynchronous logging service using ONC-RPC, designed so that client operations are never blocked by logging overhead.
  • Web Integration:
    • A SOAP-based web service, implemented in Python, for real-time data enrichment and extensibility.
  • Automated Testing Pipeline:
    • Robust bash scripts (with CMake) to build, test, and validate all components.
    • An extensive suite of automated functional and stress tests covering every major interaction and edge case.
  • Performance & Reliability:
    • Evaluated under heavy, parallel client workloads — demonstrating real throughput and bottleneck behavior, not just theoretical performance.

Noteworthy Innovations

  • Get Multifile Function:
    • Advanced parallel file download, allowing a single file to be retrieved simultaneously from multiple clients, accelerating throughput by leveraging true concurrency.
  • Fault-Tolerant Design:
    • Every service (web, RPC, server, client) can operate independently, ensuring resilience against partial outages and simplifying debugging and deployment.
  • Network Traffic Analysis:
    • Full protocol compliance and transparency validated through Wireshark, ensuring predictable behavior and clear system introspection.

Professional and Technical Skills Acquired

  • Mastery of Systems Programming:
    • Advanced concurrency management (threads, mutexes, condition variables).
    • Deep understanding of network sockets, custom protocol implementation, and error handling.
  • Automation & Tooling:
    • Built robust scripts for build, deploy, clean, and testing; learned the value of automation in real-world software engineering.
  • Cross-Technology Integration:
    • Combined C, Python, bash scripting, and networking tools to deliver a seamless, multi-language platform.
  • Full Project Lifecycle:
    • From architecture and design to coding, testing, deployment, and documentation.

Reflections

Delivering this project has given me a practical understanding of distributed systems engineering that no textbook can provide.
I’ve learned how challenging and rewarding it is to coordinate asynchronous components, to anticipate and handle errors gracefully, and to validate real-world behavior with automation and analysis tools.

It has also shown me how the technologies powering the most scalable and robust systems we use every day (from web services to cloud infrastructure) are rooted in the principles I tackled here — concurrency, communication, automation, and rigorous testing.

Limitations & Future Work

  • Security:
    • As with most academic prototypes, this system prioritizes architectural clarity and experimentation over production security; real encryption and authentication would be necessary in any public deployment.
  • NAT Traversal:
    • Local network communication works seamlessly; however, advanced NAT traversal (e.g., via UPnP) remains a challenge in many P2P systems, just as in real-world torrent clients.

Demo & Resources

  • Video demonstration (with network packet analysis):
    Watch on YouTube
  • Full technical documentation, test scripts, and code available upon request.

This project stands as a milestone in my training as a systems engineer, combining real technical depth with professional software practices and an appetite for solving complex, open-ended problems.