How rafab15/distribuidos-tp works
Main Components
• Client Component: This is where data originates. The “client” directory contains the main.go file and a Dockerfile, indicating it acts as the entry point sending games and reviews into the system.
• Service Pipeline (Distributed Processing Services): The services are logically grouped by their functionality and exist as individual microservices under the “system” directory. Examples include:
• Game Mapper: Receives game data, extracts essential fields.
• OS Accumulator and OS Final Accumulator: Aggregate game counts based on supported OS. Note the use of an EOF (“end-of-file”) signal to denote completion.
• Decade Filter: Filters games for those published in the 2010s, specifically for Indie genre.
• Top Ten Accumulator: Retains only the top 10 games with the highest average playtime.
• English Filter and English Review Accumulator: Process reviews by filtering for English language and then aggregating positive/negative counts.
• Positive Review Filter: Filters reviews with more than 5,000 positive reviews.
• Multiple Joiners and Final Joiners: These services perform matching between games and their corresponding review data.
• Review Mapper, All Review Accumulator, Top Positive Reviews, and Percentile Accumulator: Handle further processing for specific queries like percentile calculations and top positive reviews.
• Middleware: Every service has a middleware submodule for managing communications (e.g., the “middleware” directory and similar folders under each system component).
• Persistence Layer: Each service contains a “persistence” directory, typically with a “repository.go”, that handles storage and state tracking for intermediate results.
• Internal and Utils: The “internal” directory contains protocol definitions, helper utilities, partitioning logic, and serialization tools, which are foundational to ensure data flows correctly through the pipeline.
• Containerization and Orchestration: Dockerfiles for each microservice in the “client” and “system” (and its subcomponents) indicate containerization. Additionally, docker-compose YAML files are used to spin up the entire distributed architecture.
Relationships and Data Flow
• Data flows from the Game Mapper to the OS Accumulator and then to the OS Final Accumulator.
• In parallel, the pipeline for the Indie genre (games) follows: Game Mapper → Decade Filter → Top Ten Accumulator.
• For reviews, the flow is: Entry Point (possibly part of the system/entrypoint) → English Filter → English Review Accumulator → Positive Review Filter → Joiners.
• The multiple Joiner services receive pieces from both game services and review services and merge them based on matching IDs (using partitioning strategies defined in the “internal/compare_results” and “internal/client_protocol” directories).
• Finally, Final Joiners and Top Positive Reviews or Percentile Accumulator forward the final query results back to the entrypoint for delivery to the client.
Architectural Patterns and Technologies
• Microservices Architecture: Each service is self-contained, deployed in containers, and interacts via message passing or publish-subscribe patterns.
• Pipeline/Stream Processing: Services process data in a staged pipeline, each waiting for an EOF from its predecessor to indicate completion of data input.
• Horizontal Scalability: Some services are designed to scale (for example, OS Accumulator and English Review Accumulator, where partitioning is evident) to handle load distribution.
• Use of Docker Compose & Makefile: Deployment is managed using Docker Compose (with different files like docker-compose-dev.yaml) and build automation through the Makefile.
• Message Tracking and State Management: Middleware components and nodes (as seen in “internal/system_protocol/node”) suggest detailed tracking of message flows and error-handling (graceful shutdowns) across the distributed components.
• Start at the client which sends game and review data to the system through a unified entrypoint.
• How different branches of the pipeline process the data:
▪ One branch for aggregating OS support and calculating totals.
▪ Another branch for filtering by publication decade, then selecting games based on average playtime.
▪ A parallel branch handling reviews with language identification and positive/negative aggregation.
▪ Joiner modules that merge these processed datasets before final aggregation.
• Error handling and graceful shutdown procedures (referencing utilities in the “internal/utils” directory).
• Use of partitioning to keep related messages (by game ID) together for processing.