-
Notifications
You must be signed in to change notification settings - Fork 11
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
Provisions for regional caching #93
Comments
Thanks, this is a use case that we haven't put a lot of thought into yet. I have a concern with the redirection approach though as it introduces an additional roundtrip which can be quite costly for latency. Also we've taken great pains to make the protocol completely stateless (that is a server isn't required to store state to implement a conforming implementation, but it is allowed for a server to have state if it wants). I'll need to think about this some more and see if there's a way to better accommodate first request caching without introducing a redirect. If we do decide to allow for caching via a redirect, then I think we could just update the specification saying it's allowable for the server to return a HTTP redirect as long as the url it redirects too contains a valid response, but otherwise make no requirements for how the redirected url works (for example the identifiers used in the cache url). |
Ah so the spec already talks about how redirects are handled in https://w3c.github.io/IFT/Overview.html#invalid-server-response. That is it allows redirects from the server. So doing caching by redirecting to a cacheable URL is currently supported. |
I was asked to add more detail to this. Support for caching may be more important for larger-scale services than some might expect. Adobe's system has been overhauled several times specifically to increase the amount of caching and probably will be overhauled again in the future. I think there are three general areas of support for caching, the first being what has already been discussed:
|
Some good news on this front I was recently pointed towards a new HTTP method QUERY (https://httpwg.org/http-extensions/draft-ietf-httpbis-safe-method-w-body.html) which works much better for caching then GET/POST. It encodes the request data like POST but retains the cache ability of GET requests. I'd like to investigate it a bit more, but I'm strongly considering changing the specification to either exclusively use QUERY or for it at least to be the recommended method with GET/POST as fallbacks. The QUERY spec specifically recommends that normalization should be applied to the request body to generate the cache key (https://httpwg.org/http-extensions/draft-ietf-httpbis-safe-method-w-body.html#section-2.1), I think this would solve many of the problems that you mentioned. For example normalization could upgrade the requested codepoint set to a cacheable superset that is known will be served by the backend server. For the three options you mentioned:
|
That does look good! |
Tagging @martinthomson |
The current plan for enabling caching for patch subset will be either:
One additional development that's related is the investigation I made into using precompressed brotli metablocks to partially cache portions of the font. I'm going to close this issue for now as the remaining work will be tracked in the QUERY issue (#127), but please reopen if you think additional changes are needed. |
In many cases a cache hit on an augmentation set will be very unlikely. However, there are cases where caching, and in particular regional caching (e.g. Akamai), can become not just relevant but important to performance. For example, when the initial subset is for a home page of a media service and the first augmentation is for the top article. Or when the initial subset is for the home page of a company and the first augmentation is for a popular tab or the first area added dynamically when scrolling.
Whether a request can be cached by existing services often depends on the request type (GET may be required) and the URL length. At present the spec is flexible when it comes to request method and the parameters are compressed but there are no length guarantees and some cases where the codepoints and indices will be fragmented in a way that takes more bytes to specify.
Additionally, any requirements for caching will typically be understood by the server rather than the client.
One way of addressing this need is to allow the server to respond to a GET or POST request with a different, cache-compatible URL to be used for the actual download of subset or augmentation data. This is similar to a temporary redirect, and in fact one of the existing redirect codes may suffice for this purpose (I unfortunately don't know off-hand).
(This alternative URL could contain a hash value generated from a canonicalized representation of the request, with the map stored on the server side so that the response can be regenerated on a cache miss. That possibility helps illustrate how the mechanism could work but I see no need to constrain the server-side implementation in the spec. Adobe's system has, at times, used a system like this to remain regional-cache-compatible.)
I suggest adding a section to the specification that addresses regional caching along the lines above. If we're confident that one of the existing redirect codes suffices then that section might just be informational. If we are not confident then a modest extension to the protocol may be needed.
The text was updated successfully, but these errors were encountered: