Giter Club home page Giter Club logo

Comments (5)

yoavweiss avatar yoavweiss commented on September 7, 2024

How often would we expect such read failures to actually happen?

/cc @pmeenan

from compression-dictionary-transport.

pmeenan avatar pmeenan commented on September 7, 2024

It shouldn't be meaningfully different from a 304 not-modified and should probably be treated the same way. In both cases, the browser has an index where it believes the cache entry is available, makes the request and depends on the entry actually being there.

Not sure if the fetch specs actually specify the behavior in that case of if it is implementation-specific but the breakage (and overhead for checking the entry) should be the same.

from compression-dictionary-transport.

horo-t avatar horo-t commented on September 7, 2024

I was thinking about using two databases, SQLite for keeping the metadata (path, hash, etc), DiskCache for keeping the blob (binary) of the dictionary. (PoC CL: https://chromium-review.googlesource.com/c/chromium/src/+/3872966/37)
But unfortunately, DiskCache doesnโ€™t provide a way to detect the cache entry eviction. So Chrome has to open the DiskCache entry before sending the request with the sec-bikeshed-available-dictionary: header. This is not good for performance.

It sounds like using DiskCache as a blob storage is not a good idea. It is impossible to keep the two databases in sync in an efficient way. I will reconsider the design to use raw files.

Re: @pmeenan
Chrome opens the disk cache entry before sending the network request, and keeps the entry as active so that the entry would not be evicted. So 304 not-modified responses can be handled correctly even if the eviction logic has been triggered.
https://source.chromium.org/chromium/chromium/src/+/main:net/http/http_cache_transaction.cc;l=734;drc=e672a665ffa8fe4901184f03922e2cc548399da5
I think we should not block the browser from sending the request while opening the dictionary file.

from compression-dictionary-transport.

yoavweiss avatar yoavweiss commented on September 7, 2024

Would it help if we added a requirement that dictionaries must be immutable? We could then maybe tweak the eviction logic to make sure they don't get evicted while there's a request that relies on them in flight

from compression-dictionary-transport.

horo-t avatar horo-t commented on September 7, 2024

Adding such a requirement sounds good to me.

By the way, @nhiroki told me that using APP_CACHE CacheType can prevent the auto eviction. So I think I can use DiskCache as a storage for the shared dictionary, just like Service Worker scripts and CacheStorage.

from compression-dictionary-transport.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.