Persistent Cache
See original GitHub issuehttps://github.com/vitejs/vite/issues/1207#issuecomment-753564633
Vite’s current biggest performance bottleneck is first page load with large amount of modules. This is mostly caused by congestion at the browser network layer, since every module results in a full HTTP GET request on fresh server start.
To improve this, we can dump the in memory transform cache to disk on server close, and “hydrate” the module graph on next server start (the hydration should only fill in the cache for files with still fresh mtimeMs
). The cache can be dumped in one file so it should be relatively fast to deal with. This allows the server to directly send 304s even on a restart.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:112
- Comments:19 (4 by maintainers)
Top Results From Across the Web
The Persistent Cache - W3C
The file cache is intended for intermediate term storage of documents or data objects. The libwww cache is a fully HTTP/1.1 compliant client...
Read more >Persistent Lookup Cache - Informatica Documentation
A persistent lookup cache is a cache that the Integration Service reuses for multiple runs of the same mapping. Use a persistent lookup...
Read more >persistent-cache - npm
A simple module to persistently store/cache arbitrary data.. Latest version: 1.1.2, last published: a year ago. Start using persistent-cache ...
Read more >Persistent cache - Learning Informatica PowerCenter 10.x
When you use non-persistent cache every day, the same data will be stored in cache; this will waste time and space every day....
Read more >Persisting Caches - Oracle Help Center
Coherence persistence is a set of tools and technologies that manage the persistence and recovery of Coherence distributed caches. Cached data is persisted ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
we started to migrate our monorepo to vite. our biggest frontend project has around 2800 modules on load. we were able to reduce it to 1800 with lazyload after some work. currently, we offer vite as an alternative alongside webpack, but it’s not the default bundler yet, in dev. the main reason why we can’t deprecate our webpack dev in favor of vite alternative is that it takes a long time to reload the page. the load of 1800 creates a great bottleneck, and in our case, it can take from 10s to 20s depending on how much load there’s on the developer machine.
Suggestion: cache the files with a service worker, that after the first load, at least any consecutive load would be fast, and when a module is being changed that info can be transmitted by the hmr mechanism/websocket and deprecate the out of dated module.
Unfortunately, we’ve halted the vite migration from webpack. We couldn’t find an intermediate solution for this. Developers preferred one slow load and fast refreshes than fast first load and long refreshes