- 
                Notifications
    
You must be signed in to change notification settings  - Fork 4
 
Description
What
Currently our JS client offers two kinds of smart fetches:
- 
We fetch through DNS, and then if the request completely failes (after 5 seconds) we retry as a fallback using a node return from the orchestator.
 - 
We immediately race both DNS AND multiple nodes returned from the orchestrator and take the request that returns a first byte (
 
We proposes a third "request hedging" approach:
- Initiate a request with DNS
 - If a time equaling Saturn's P90 TTFB passes without receiving a first byte, start a second request to an orchestrator node, and take which ever returns a first byte first (cancleling the other)
 
Why
Our first approach suffers from being a very non-ideal experience -- while the fallback prevents a complete failure, it only falls back after such a long time (i.e. 5 seconds) as to provide a terrible experience for the user.
Our second approach we have found to generate a high amount of duplicate traffic -- we've even overloaded the log ingestor a couple times this way.
This approach essentially aims to improve the fallback experience of our first approach without incurring the problems associated with the second approach.
Cost
To get this done we would need to:
- implement the third "request hedging" approach in the JS client, available as an option on the request
 - for P90 TTFB for now we might just manually copy whatever our current value is
- a future improvement might retrieve this value from the orchestrator along with the list of proximate nodes
 
 - deploy and test as an experiment on the arc network
 - deploy as the primary strategy in ARC and the service worker