A talk on building applications with magical user experiences on cellular mobile networks. We discuss an application protocol developed within Uber to make mobile experiences realtime and responsive.
Find me @ hackinghabits.com
11. Uber App Experience Challenges
● Time-to-launch app critical on 3G or slower networks
● Synchronize across multiple apps (driver, rider)
● Over tens of parallel RPC request to load various
features at app launch, all competing for resources
● Network used is usually cellular and not WiFi
● Polling is expensive
● Polling payloads change less frequently
● Best polling frequency of N second.
● Higher data consumption
13. Key Choices
● Moving from sync to async architecture
○ Use of reactive pattern inside apps
○ Reducing blocking network call dependencies
● Reduce client-server interactions
○ Moving from poll to push
14. Components of a Push System
Trigger Service API Layer Push Server App
Pushes
consumer
When to Push? What to Push? How to Push?Triggers
15. Push Protocols
Long Polling
● Work with our HTTP proxies
● Available in browsers
● Simple client implementations
Server Sent Events
● SSE has fewer reconnect roundtrips,
● Lower latency
Client Server
CONTINUE
CONNECT
MSG
45 Sec
MSG
CONNECT
CONNECT
CONNECT
Client Server
CONNECT
MSG
MSG
MSG
MSG
Long Polling Server Sends Events
16. Leveraging Server Sent Events
● Advantages
○ Simple to implement and understand
○ Works on top of HTTP
● Challenges
○ Unidirectional
○ No Visibility
○ Hard to detect broken connections
17. Introducing Ramen
● Real-time Asynchronous MEssaging Network
● HTTP SSE-based push protocol
● Ensures at least once delivery of a push message
● Optimizes amount of data transfer
19. Ramen Protocol continued..
● Heartbeats every 5 seconds to detect connection failure
● Message acknowledgement every 30 seconds
● Push message wire priority
○ High
○ Medium
○ Low
20. How speed up app launch?
● App launch process
○ App establishes a Ramen connection with server
○ App make one request to backend - /app/launch
■ Endpoint returns 1 MTU (1500 bytes)-sized response
■ /app/launch also acts as a async trigger to our push systems
○ Based on back-end user state, server generates tens of pushes
○ Pushes are sent on Ramen connection by their priority
○ Based on data in push, experience is rendered on the mobile side
23. How did we make the entire app more
responsive?
● App launch process
○ App establishes a Ramen connection with server
● On any state machine change
○ Kafka events trigger the push systems
○ Based on type of event and backend state, pushes are generated
○ Pushes are sent over the Ramen connection
● All polling calls were changed to push
● Larger pushes were broken down to smaller pushes
● Enforcement and education about payload sizes
24. Concurrent Connections
1M+
Types of apps
20+ Messages Streamed Per
Second
100K+
Messages Delivered for
Driver app
99%
Rider
Driver
Uber Lite
Uber Eats
Restaurants
Uber Fleet
Uber Freight
Web
Jump Bikes
Insights