-
Notifications
You must be signed in to change notification settings - Fork 20
pass in context for related calls to allow for caboose affinity #53
Comments
This comment was marked as resolved.
This comment was marked as resolved.
I think we have a pretty good candidate for “affinity” key in gateways: the content path (after subdomain/host header normalizations): contentPath := ipath.New(r.URL.Path) It will always look like Caboose could read it and decide if it wants to use the full path, or only the root identifier (which would improve affinity even further, grouping all block requests for the same content root together). + const GatewayContentPathKey = "contentPath"
contentPath := ipath.New(r.URL.Path)
+ ctx := context.WithValue(r.Context(), GatewayContentPathKey, contentPath)
+ r = r.WithContext(ctx) @hacdias will you have time to wire this up in go-libipfs/gateway and bubble up to a PR here? 🙏 |
I also want to add here that since context keys should not be strings, the affinity key in caboose might have to be changed to |
I removed the need for This should be good enough for now, we can refine what we do with |
caboose was coded in it's current blockstore incarnation to expect that requests would have a key on the context for the 'root cid' of the request that could better group related inbound requests.
this is set via an
affinityKey
https://github.com/filecoin-saturn/caboose/blob/main/caboose.go#L134 to the config, and thenusing
context.WithValue()
to set the key to a value when it makes its way to the blockstore.We can probably have that value just be the inbound request URL and things will get much better
(e.g. the caching of block on L1s will actually work)
The text was updated successfully, but these errors were encountered: