-
Notifications
You must be signed in to change notification settings - Fork 10
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
code splitting / chunking of cache.json files #317
Comments
@hutchgrant |
Yes I agree. This is a concern we will need to address or scaling larger than 300 pages or using too much data(too many large queries) on <100 could cause problems with slow page load times. |
😬 |
The deepmerge within serialize.js is where we're getting this large cache from. There are 2 queries in the app-template (one isn't necessary), one in the header, and one in the shelf. That's how you have so many requests being made. Also I don't know if our hydration logic is correct either. In any event, the deepmerge approach can be tweaked so that maybe we dont include 8 pages worth of cached queries into a single cache.json file? |
const response = await Promise.all([
await client.query({
query: ConfigQuery
}),
await client.query({
query: GraphQuery
})
]); That graph query is massive and when each page is serialized that will be added to every single cache. It's only needed once on initial page load for SPA and could arguably be filtered in the resolver instead. Similarly the header/shelf only need to be queried once. Therein lies another problem. Many different optimizations are needed here. |
Some thoughts on quick wins here
For something like docs/cache.json, this could bring the size down to 35k! We should also try and add a "budget" spec for this to make sure the size can't explode again without it failing at least. Later down the road, we should look to reduce duplication of query results across all cache.json files, e.g. (about/cache.json, docs/cache.json) |
Moving the conversation to #345 for the performance and optimizations solutions. The original intent of this issue is too far ahead of our immediate needs right now so don't want to conflate these things too much. |
Another thought with this, like for the graph, is to maybe just be able to filter it per route, like we do with menu? This might help cut down a lot on data returned per index.html, but then you might need to save cache.json per route and sub route, instead. |
Type of Change
Summary
While code splitting helps with chunking horizontally across routes, for a full graph with hundreds or thousands of pages, a call to the graph would result in huge cache.json file.
We need to think about how to split this up, so cache.json file can be chunked too.
Details
The text was updated successfully, but these errors were encountered: