blog: https://remix.run/blog/fog-of-war
虽然我能理解借助 prefetch 可以提前加载某些 Routes 以提高页面跳转性能,但是过度使用 prefetch 会不会导致服务器过载呢?
prefetch 的问题
- 不必要的请求增多
- 网络带宽浪费
- 数据库压力
- 缓存有效性
先理解需求,在考虑解决方案。过早优化是万恶之源。
- project develop 阶段其实可以忽略,make it work first
- 分析和监控:分析哪些 routes 需要 prefetch 哪些需要 lazy load
- 必要时,甚至需要对一些 routes 进行限流