The LinkedIn Android Data Pipeline

Karthik Ramgopal
8 min readadvanced
--
View Original

Overview

The article discusses the design and implementation of the LinkedIn Android Data Pipeline, which optimizes data flow between the app and server. It highlights the goals of creating a universal, intelligent, high-performance, and testable data pipeline that enhances app responsiveness and developer productivity.

What You'll Learn

1

How to design a universal data pipeline for mobile applications

2

Why intelligent caching strategies are crucial for mobile app performance

3

How to implement a custom binary format for caching models

4

When to use streaming support in networking libraries

Prerequisites & Requirements

  • Understanding of data pipeline concepts and mobile app architecture
  • Familiarity with REST APIs and JSON data formats(optional)

Key Questions Answered

What are the main design goals of the LinkedIn Android Data Pipeline?
The main design goals include creating a universal pipeline for various app features, implementing intelligent data fetching and caching strategies, ensuring high performance with minimal footprint, and making the pipeline testable for automated testing. These goals aim to enhance user experience and developer productivity.
How does the data manager interact with the cache and network?
The data manager requests data from both the cache and the network in parallel. If the data is available in the cache, it is returned immediately; otherwise, a network request is made to fetch the data from the server, which is then parsed and returned to the UI component.
What is the purpose of the fission cache in the data pipeline?
The fission cache flattens model trees and caches each sub-model individually to reduce duplication and improve cache hit rates. This allows for efficient retrieval of cached data while minimizing storage waste and ensuring consistency across responses.
How does the consistency manager enhance user experience?
The consistency manager synchronizes changes between models used in different parts of the app through recursive change notifications. This ensures that updates, such as likes on posts, are accurately reflected across various UI components, enhancing user experience.

Technologies & Tools

Backend
Rest.li
Used for building front end servers that handle model requests.
Backend
Pegasus Schema Definition Language
Used for defining model schemas in the application.
Backend
Jackson
Used for stream parsing and serialization of JSON data.
Backend
Volley
Used for managing network requests and prioritization.
Backend
Okhttp
Used for efficient HTTP requests and connection management.

Key Actionable Insights

1
Implement intelligent caching strategies to enhance mobile app performance.
By caching data intelligently, apps can reduce network calls and improve responsiveness, especially in environments with flaky connections. This is crucial for maintaining a smooth user experience.
2
Utilize a consistency manager to synchronize model changes across the app.
This approach minimizes manual work for developers and reduces the risk of bugs related to inconsistent data, ensuring a seamless experience for users.
3
Consider using a custom binary format for caching to improve performance.
This method can significantly reduce the overhead associated with JSON parsing, especially on low-end devices, leading to faster app startup times.

Common Pitfalls

1
Relying solely on traditional caching methods can lead to data inconsistency and wasted storage.
Traditional caches often store responses as key/value pairs, which can result in duplicated data and inconsistencies when the same model appears in multiple responses. Implementing a more sophisticated caching strategy, like the fission cache, can mitigate these issues.