-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
filter: Add HttpCache interface and helpers #9878
Conversation
Signed-off-by: Todd Greer <tgreer@google.com>
Signed-off-by: Todd Greer <tgreer@google.com>
I messed up some of the protoc magic. I'll take another stab at it as soon as I'm back in the office or otherwise find time--sorry for the premature review request. |
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.
looks good modulo 1 nit; will need API approval though.
I have a question about that -- really for @htuch or other @envoyproxy/senior-maintainers -- this is an extension but there is a modification here to what appears to be the core Envoy API. Should we have a different directory for the API provided by an extension, that doesn't require API maintainer review?
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.
Quick high level question, thank you.
/wait
Signed-off-by: Todd Greer <tgreer@google.com>
PTAL. |
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.
I need to run but flushing out one comment now and will look more later. Very cool stuff!
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.
Thanks LGTM from a high level skim. Just some small random comments. Thank you!
/wait
// Headers of the cached response. | ||
Http::HeaderMapPtr headers_; |
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.
This will require copying the headers for every cached response, which seems not-optimal. Since this is in the encoding path and I think we encode with a const ref do we need to copy here?
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.
StreamDecoderFilterCallbacks::encodeHeaders takes a HeaderMapPtr&&, so I don't think I have any alternatives. It seems fine though: we're going to have to create a HeaderMap for the cache entry; handing its ownership to the callbacks makes sense.
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.
OK but then we have to needlessly copy on every cached hit response? In any case, we can deal with this later, but maybe put in a perf TODO somewhere relevant?
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.
I'm not seeing where the needless copy is. Cache storage implementations will generally store a serialized form of the response headers. When ready to serve an entry, they'll create a HeaderMap from it, owned by a HeaderMapPtr, which they'll give to encodeHeaders. Implementations might copy the headers into the HeaderMap, or they might create a new subclass that references the serialized form. If an implementation chooses zero-copy, these interfaces won't get in the way.
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.
It seems like an in-memory implementation could store the actual HeaderMap object. In any case, we can deal with this later.
Signed-off-by: Todd Greer <tgreer@google.com>
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.
Thanks!
Thank you for the rapid reviews! |
Description: Adds HttpCache, the pluggable interface for CacheFilter (#868, #7198)
Risk Level: Low. Nothing calls or any of the new code.
Testing: Unit tests.
Docs Changes: none.
Release Notes: N/A
#868