Rest.li: RESTful Service Architecture at Scale

Joe Betz
4 min readintermediate
--
View Original

Overview

Rest.li is a REST+JSON framework developed by LinkedIn for building scalable service architectures. It emphasizes dynamic discovery, asynchronous APIs, and a developer-friendly workflow that promotes type-safety and consistent data modeling.

What You'll Learn

1

How to build scalable RESTful services using Rest.li

2

Why dynamic discovery is important in service-oriented architectures

3

When to use asynchronous APIs for high-load services

Prerequisites & Requirements

  • Understanding of RESTful API principles
  • Familiarity with Java programming

Key Questions Answered

What is Rest.li and how does it function?
Rest.li is a Java framework designed for building RESTful services using an entity-oriented design. It utilizes standard HTTP verbs and a flexible serialization scheme, allowing for efficient access to large datasets and type-safe resource handling.
How does Rest.li ensure scalability for high-load services?
Rest.li is built to handle several thousand queries per second per instance, utilizing asynchronous APIs and batch operations to efficiently manage high loads. This design allows for rapid API development even for developers less familiar with REST.
What role does ZooKeeper play in Rest.li's architecture?
ZooKeeper is used as a registry for dynamic service discovery in Rest.li. It provides clients with up-to-date information about available services, enabling effective client-side load balancing and reducing the load on overloaded servers.
What are the key benefits of using Rest.li for Java developers?
Rest.li offers a lightweight framework that promotes REST best practices, making it accessible for developers of all skill levels. It supports type-safe access to resources and simplifies the process of building robust APIs.

Technologies & Tools

Framework
Rest.li
Used for building scalable RESTful services.
Service Discovery
Zookeeper
Provides dynamic service discovery and client-side load balancing.
Networking
Netty
Used to build the HTTP implementation for Rest.li's R2 transport layer.

Key Actionable Insights

1
Leverage Rest.li's batch operations to enhance performance when dealing with large datasets.
Batch operations allow multiple requests to be processed in a single call, significantly reducing latency and improving throughput in high-load scenarios.
2
Utilize ZooKeeper for dynamic service discovery to maintain high availability and load balancing.
By integrating ZooKeeper, applications can automatically adapt to changes in service availability, ensuring that clients always interact with the most responsive instances.
3
Adopt Rest.li for new services to standardize API development across your organization.
Standardizing on Rest.li can streamline development processes and improve maintainability, as all services will adhere to a uniform interface and data model.

Common Pitfalls

1
Failing to properly implement asynchronous APIs can lead to performance bottlenecks.
Asynchronous programming requires a different mindset compared to synchronous approaches. Developers must ensure that they understand how to manage callbacks and handle potential race conditions.

Related Concepts

Restful API Design
Service-oriented Architecture
Asynchronous Programming Patterns