Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Segment Cache] Implement behavior on cache miss #72841

Merged
merged 2 commits into from
Nov 15, 2024

Commits on Nov 15, 2024

  1. [Segment Cache] Implement behavior on cache miss

    In the current navigation implementation, a partially dynamic navigation
    always does two separate requests: one for the static data, and one for
    the dynamic data. Typically the static data is prefetched before the
    navigation begins, but even in the case where it is not, the current
    implementation will still fetch it first. It then wait to send a dynamic
    request until the first chunk is received from the prefetch response,
    leading to an unfortunate request waterfall.
    
    In the Segment Cache implementation, our plan is to never block a
    navigation on prefetch data that isn't already populated in the cache.
    Instead, in the case of a cache miss, we'll immediately start a dynamic
    navigation and rely on the fact that the first thing the dynamic
    response sends is the static PPR shell of the target page.
    
    Because we'll always have this as a fallback behavior for cache misses,
    it's a good starting point for the Segment Cache implementation. Then
    we can start incrementally adding more and more features until we've
    eventually reached/surpassed parity with the current implementation.
    
    ---
    
    To avoid duplication of logic, I've chosen to model cache misses as a
    special case of the normal static + dynamic flow. We can pretend that
    the route tree returned by the dynamic request is, in fact, the result
    of a prefetch. Then we use that same server response to write data into
    the CacheNode tree. So it's the same flow as the "happy path", except we
    use a single server response for both stages.
    acdlite committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    4ab3e39 View commit details
    Browse the repository at this point in the history
  2. Add basic navigation test for Segment Cache

    Almost nothing in the Segment Cache is implemented yet — all
    navigations result in a cache miss. This just confirms that when a
    cache miss occurs, it successfully navigates to the next page.
    acdlite committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    32c16a3 View commit details
    Browse the repository at this point in the history