NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

RecService: Distributed Real-Time Graph Processing at Twitter

Ajeet Grewal, Jerry Jiang, Gary Lam, Tristan Jung, Lohith Vuddemarri, Quannan Li, Aaditya Landge, Jimmy LinHotCloud 2018

TL;DR

RecService is a distributed graph processing engine designed to power real-time recommendations at Twitter. It tackles the challenge of generating billions of personalized recommendations by framing them as intersections between a user's social context and real-time events, enabling a novel, horizontally scalable architecture that avoids network bottlenecks.

What Problem Does This Paper Address?

The core problem this paper addresses is the need for a highly scalable and efficient system to generate personalized recommendations in real-time for a massive social network like Twitter. Traditional recommendation systems often rely on batch processing of static data, which fails to capture the dynamic nature of user interactions and trending topics. Twitter users expect to be informed about what's happening now, whether it's a new tweet from someone they follow, a trending hashtag, or a live video broadcast. This requires processing a constant stream of events and relating them to a user's existing social graph, a computationally intensive task that can easily lead to performance bottlenecks, especially with "supernodes" (highly connected users).

Methods

RecService introduces a novel approach to distributed graph processing for recommendations by separating the handling of the "social context graph" (who follows whom, which is relatively static) and "real-time event graphs" (likes, tweets, replies, etc., which are highly dynamic).

  • Partitioning Scheme: The social context graph is partitioned across multiple cluster nodes. Crucially, all graph manipulations (lookups, traversals, intersections) for a given user are performed locally on the node responsible for that user's partition. This eliminates cross-node network traffic during query execution, a major innovation for scalability.
  • Real-time Event Handling: In contrast, real-time event graphs are replicated across all nodes. This allows any node to quickly access the latest engagement data relevant to its local social context partitions.
  • Query Types: RecService supports two main query types:
  • Point Queries: Ad hoc queries that reference a specific social context and events (e.g., "What hashtags are my influencers talking about?").
  • Standing Queries: Long-lived queries that trigger automatically when certain real-time event conditions are met for a user's social context (e.g., "Notify me if one of my influencers starts a live video stream").
  • Data Structures: The social context graph is stored as adjacency lists and its transpose for efficient bidirectional traversal. Real-time event graphs are also stored as adjacency lists, typed by engagement type.

Datasets

Not discussed in the paper. The paper focuses on the system architecture and its application to Twitter's internal data, which is not presented as a public dataset.

Key Insights and Ideas

  • Social Context vs. Real-Time Events Dichotomy: The fundamental insight is that treating these two types of graph data differently (partitioning static social context, replicating dynamic events) is key to achieving both scalability and real-time responsiveness.
  • Node-Local Operations are Crucial: Eliminating cross-node network traffic for graph operations, especially for highly connected vertices, is the cornerstone of RecService's horizontal scalability and avoidance of "hot spots."
  • Framing Recommendations as Intersections: The paper highlights the power of framing recommendations as intersections between social context and real-time events, enabling flexible and explainable recommendation generation (e.g., "social proof" for trends).
  • Standing Queries for Proactive Notifications: Standing queries are powerful for proactive, timely notifications (like live video alerts), though they are noted as being more challenging to formulate than point queries.

Key Results

  • Scalability: The system is designed for horizontal scalability, with the social context graph partitioned across 256 partitions on 64 machines.
  • Performance:
    • Serves approximately 20k point queries per second with a median latency of 2ms and 99th percentile latency of 13ms.
  • Real-time event ingestion averages 12k events/sec (peak 17k/sec), with a median latency of 150ms from event to graph reflection (99th percentile 430ms).
  • Standing queries execute with similar performance to point queries, with recommendations written back to Kafka in well under one second.
  • Recommendation Volume: Currently generates about 450 recommendations per second from standing queries.

Limitations and Future Work

  • Standing Query Complexity: The authors acknowledge that formulating standing queries is conceptually more challenging than point queries, leading to fewer productionized standing queries.
  • Future Work:
    • Adding more queries to power downstream products.
  • Developing better ways for algorithm designers to reason about highly dynamic graphs.
  • Integrating graph-based signals with other data sources like tweet content and location.
  • Continuing to refine the system for surfacing relevant, personalized, and timely content.

Summary updated

BibTeX
@inproceedings{grewal2018recservice,
  author = {Ajeet Grewal and Jerry Jiang and Gary Lam and Tristan Jung and Lohith Vuddemarri and Quannan Li and Aaditya Landge and Jimmy Lin},
  title = {{RecService: Distributed Real-Time Graph Processing at Twitter}},
  booktitle = {HotCloud},
  year = {2018},
  url = {https://openreview.net/forum?id=Vaz56KKQji},
}
Figure