Video and slides synchronized, mp3 and slide download available at URL https://bit.ly/2x0Fav8.
Jose Nino guides the audience through the journey of Mobile APIs at Lyft. He focuses on how the team has reaped the benefits of API generation to experiment with the network transport layer. He also discusses recent developments the team has made with Envoy Mobile and the roadmap ahead. Filmed at qconlondon.com.
Jose Nino works as a Software Engineer at Lyft.
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Next Generation Client APIs in Envoy Mobile
1. Jose Nino
@junr03
Next Generation Client APIs
with Envoy Mobile
QCon London - March 2020
Some slides built in collaboration with: @goaway & @rebello95
2. InfoQ.com: News & Community Site
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
api-envoy/
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
3. Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon London
www.qconlondon.com
12. We recognized two important dimensions
in API management: what data we send
(shape), and how we send it (transport).
@junr03
~3 years in Server Networking
13. Server-side Interface Definition Language (IDL)
Service A
“server”
@junr03
#service_a.proto
service ServiceA {
rpc UpdateA(ARequest) returns (AResponse) {
option (http.http_options).path = "/service_a";
option (http.http_options).method = "POST";
}
}
Service B
“client”
14. ● Network Proxy driven by Open-source
(OSS) community
● Common substrate for network behavior
What is ?
@junr03
Sidecar
Service B
“client”
Sidecar
Service A
“server”
18. Three 9s of reliability at the server-side is
meaningless if the user of a mobile client is only
able to complete the desired product flows a fraction
of the time.
What do we want from our Client APIs?
@junr03
19. Consistency ? ✓
Performance ? ✓
Extensibility ? ✓
Resilience ? ✓
Security ? ✓
Observability ? ✓
Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
@junr03
21. Next generation Client APIs with Envoy Mobile
Mobile Client
@junr03
API
��
We recognized two important dimensions
in API management: what data we send
(shape), and how we send it (transport).
~1 year in Client Networking
22. We recognized two important dimensions
in API management: what data we send
(shape), and how we send it (transport).
@junr03
API Shape
23. Early API workflow at Lyft
Tech spec
handwritten.swift
handwritten.kt
handwritten.py/.go
@rebello95
39. // Modules/FooV1API/FooAPI.swift
public struct FooRequest: Codable, Equatable { … }
public struct FooResponse: Codable, Equatable {
public let id: Int64
public let firstName: String
}
Generated models
@rebello95
42. // Modules/FooV1APIMock/FooAPI.swift
open class FooMockAPI: FooAPI {
open lazy var mockUpdateFoo: (FooRequest)
-> Result<FooResponse, FooAPIError> = { … }
open func updateFoo(_ request: FooRequest)
-> Single<Result<FooResponse, FooAPIError>> { … }
}
Generated mocks
@rebello95
43. ● Single source of truth for all APIs
● Consistent, generated code on all platforms
● Highly testable
● Underlying transport fully abstracted 🌟 565958
Results
@rebello95
48. ● 40%+ reduction in payload sizes
● Faster response times
● Higher success rates
● Transparent to engineers
Wins from protobuf
@rebello95
49. Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
@junr03
Consistency ✓ ✓
Performance ✓ ✓
Extensibility ? ✓
Resilience ? ✓
Security ? ✓
Observability ? ✓
53. Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
@junr03
Consistency ✓ ✓
Performance ✓ ✓
Extensibility 🤔 ? ✓
Resilience ? ✓
Security ? ✓
Observability ? ✓
54. We recognized two important dimensions
in API management: what data we send
(shape), and how we send it (transport).
@junr03
API Transport
58. Why is world domination transport standardization useful?
● Write once, deploy everywhere
● Common tooling for common problems
● Reduce cognitive load
@goaway @junr03
59. Envoy Mobile to the rescue!
● v0.1: proof-of-concept
● v0.2: laying the foundation
● v0.3: first production-ready release
@goaway @junr03
60. Envoy as a Library
@junr03
How did we turn a network proxy into a
networking library?
77. Build an Engine
let envoy = try EnvoyClientBuilder(domain:
"api.envoyproxy.io")
.addLogLevel(.warn)
.addStatsFlushSeconds(60)
.build()
@goaway @junr03
78. Build an Engine
let envoy = try EnvoyClientBuilder(domain:
"api.envoyproxy.io")
.addLogLevel(.warn)
.addStatsFlushSeconds(60)
.build()
@goaway @junr03
79. Build a Request
let request = RequestBuilder(path:
"/pb.api.v1.Foo/GetBar")
.addHeader(name: "x-custom-header", value: "foobar")
.build()
@goaway @junr03
80. Build a Request
let request = RequestBuilder(path:
"/pb.api.v1.Foo/GetBar")
.addHeader(name: "x-custom-header", value: "foobar")
.build()
@goaway @junr03
81. Build a Response Handler
let handler = ResponseHandler()
.onHeaders { headers, status, _ ->
...
}
.onData { data ->
// Deserialize message data here
}
...
@goaway @junr03
82. Build a Response Handler
let handler = ResponseHandler()
.onHeaders { headers, status, _ ->
// Product logic
}
.onData { data ->
// Product logic
}
...
@goaway @junr03
83. Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
@junr03
Consistency ✓ ✓
Performance ✓ ✓
Extensibility 🤔 ? ✓
Resilience ? ✓
Security ? ✓
Observability ? ✓
87. Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
Consistency ✓ ✓
Performance ✓ ✓
Extensibility ? ✓
Resilience ? ✓
Security ? ✓
Observability ? ✓
@junr03
102. Three 9s of reliability at the server-side is meaningless if the user of a mobile
client is only able to complete the desired product flows a fraction of the time.
What do we want from our Client APIs?
@junr03
Consistency ✓ ✓
Extensibility ✓ ✓
Performance ✓ ✓
Resilience ✓ ✓
Security ✓ ✓
Observability ✓ ✓
103. Onwards!
● Additional functionality in filters
● Protocol Experimentation with QUIC
● OSS Code Generators: complete OSS ecosystem for model-based
APIs.
@junr03
104. Next Generation Client APIs
@junr03
Model-based APIs defined in a strongly-typed IDL
so platform engineers can iterate on behavior using
a common transport layer.