-
Notifications
You must be signed in to change notification settings - Fork 5
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
Intercept fetches to R2 and use direct CARPARK pull #141
Conversation
blocked by storacha/blob-fetcher#30 |
24f687a
to
d79f917
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks good to me but does require non-multipart byte range requests from the fetcher.
Do you see the 200ms perf issue when hitting the public URL directly...or just from the worker? I'm just wondering if it's the public bucket code that needs optimizing? https://github.com/storacha/public-bucket - looks like it does a bucket.head
then bucket.get
for all requests - perhaps that's the difference?
src/middleware/withCarParkFetch.js
Outdated
if (rangeHeader) { | ||
try { | ||
range = parseRange(rangeHeader) | ||
} catch (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (err) { | |
} catch (err) { | |
console.warn('parsing range header', err) |
51e9393
to
e0ba7c8
Compare
e0ba7c8
to
c1944ff
Compare
@alanshaw now uses the public public handler directly. perf looks really good: |
Goals
When we fetch blocks from an R2 CARPark URL, we appear to get TTFB around 400ms. Interestingly, if we instead use Cloudflare Worker's direct R2 access, our TTFB drops to around 200ms. Bandwidth doesn't seem to change much, but this is still an important win.
Implementation
For Discussion
Comparison traces, note the average TTFB of 200 vs 400 on requests to R2
Regular fetch:
With intercepted direct gets to R2: