pln-planning-tools / Starmap

Roadmap Planning Tool
https://starmap.site
Other
20 stars 8 forks source link

feat: improve caching experience #380

Closed SgtPooki closed 11 months ago

SgtPooki commented 1 year ago

Caching speeds slowed down slightly when adding vercel caching and fixing the fetch Error issues.

We need to investigate if there's anything else we can do to improve speeds here.

There seems to be a caching related performance degradation. Whenever I reload using cmd-r, all of the data is being fetched again, I think it doesn't really use the cache for me

https://github.com/pln-planning-tools/Starmap/assets/1173416/61bb3b61-1e3f-4c34-9c5f-4a69d36307f3

I would expect CMD+R to use the cache. CMD+Shift+R should reload without cache. In the video recording above I'm simply hitting enter on the address bar

It doesn't flash the cached content before refetching, as I described above, it just seems to never use a cache?

### Tasks
- [ ] Confirm caching is working at service-worker level (it should return response immediately if it has cache, but re-populate it's cache with a second query)
- [ ] Confirm caching is working at the vercel level (it should have cache-hit or miss value when it has or doesn't have cache)
- [ ] optimize cache-control and stale values 
momack2 commented 11 months ago

@SgtPooki @biglep @whizzzkid - can we prioritize this please? This is a major usability issue for starmap and we're planning to use it next week in Iceland

whizzzkid commented 11 months ago

@momack2 looked into it, nothing changed so should not degrade all of a sudden. The slowness is only on first load and not on subsequent. I wonder:

I validated the caching both on the edge and in the browsers is working as expected. I turned on monitoring on vercel to validate the slow call paths.

https://github.com/pln-planning-tools/Starmap/assets/1895906/c6680626-b698-4568-85c7-ef707eea0c68

https://github.com/pln-planning-tools/Starmap/assets/1895906/bd5dcf6a-1a86-4f7f-b1b5-bd24a17eb515

momack2 commented 11 months ago

https://github.com/pln-planning-tools/Starmap/assets/618519/36d311ad-84eb-48f0-8a1f-62925bca71f2

This is what I'm seeing - but maybe the caching works differently than I expect? I expect starmap to load each github issue once, and then cache the content for all future viewers until the content changes so it can provide fast loads. Instead - even though I know I've loaded this page 10+ times since it last changed - I have to wait 30+ seconds for the content to load (even if I close the window and then immediately re-open the page). This makes it very slow and cumbersome to work with.