> For the complete documentation index, see [llms.txt](https://sliu583.gitbook.io/blog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sliu583.gitbook.io/blog/conference/index/sosp-21/learning/bladerunner-stream-processing-at-scale-for-a-live-view-of-backend-data-mutations-at-the-edge.md).

# Bladerunner: Stream Processing at Scale for a Live View of Backend Data Mutations at the Edge

#### Problem statement&#x20;

* Users of Facebook services access the social graph from around the world&#x20;

![](/files/uwRjeo4aRwKith4Liclg)

* Challenges on data liveness&#x20;
  * The social graph is constantly mutating and providing every one of our end users with fresh and up-to-date data is challenging&#x20;
  * Challenges&#x20;
    * Mutability and relevance&#x20;
      * Parts of the social graph can mutate at a high rate and some contents are time sensitive&#x20;
    * Rapid changing foci&#x20;
      * Users change the focus of their interest frequently&#x20;
    * Legacy substrate &#x20;
      * Client devices have limited processing power and storage capacity&#x20;
* Polling solution&#x20;
  * Client device issuing initial query when needed and then periodically polling server for updates.&#x20;
    * Wastes network bandwidth and client battery&#x20;
    * Leads to many costly queries to server&#x20;
      * Range queries, intersection queries that are costly&#x20;
    * Polling interval introduces extra latency&#x20;
* Bladerunner architecture&#x20;

![](/files/1KBJMWKGgeWXeAoMNNnU)

![Query data and Establish subscription ](/files/VaSc1nUVdXcKi0KIsf3h)

![Issue mutation and trigger publish](/files/U5pYRvvZHYoca2kIqUHV)

![Event fanout and data delivery ](/files/aGHT8Sk1CVpr9qwinI7c)

* Deep Dive - Pylon&#x20;
  * Simple pub/sub system that delivers published messages to BRASSes across regions
  * &#x20; ![](/files/Lxg9bejDSlnpsDt63Y6C)
* Deep Dive - BRASS&#x20;
  * responsible for application-specific stream processing&#x20;
  * ![](/files/KkXHZmC44kGeOKqZVIaF)
* Deep Dive - BURST
  * &#x20;application-layer protocol developed to support long running streams between client devices and BRASSes&#x20;
  * ![](/files/Fqz1FAG2GcS3ZsYdXSAF)
* Deep Dive - Failure Handling and Delivery Guarantee&#x20;
  * BRASS and BURST are designed to provide flexibility in choosing different levels of delivery guarantees, while most applications on Bladernner today only require best effort delivery&#x20;
* Use case&#x20;
  * Comments for live videos&#x20;
* Production experience - live video comments&#x20;
  * Huge efficiency wins after switching from polling to Bladerunner, besides reduced latency in comment delivery&#x20;
* Other learnings&#x20;
  * Explicitly specify liveness requirement for product services&#x20;
  * Ranking?&#x20;
    * Polling: batchify&#x20;
    * Bladerunner: wait between latest items v.s. more engaging items in product experience&#x20;
