Replies: 1 comment 3 replies
-
These are both interesting ideas.
So initial load for everything just fetches everything... After that point, new users would hit the KV session independent stuff on their initial load and there user stuff fetched from the DB. Navigation after that would cache in the client, or on miss try the edge, or go to the DB. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to propose 2 features for SolidStart:
Details:
1. With little help from Service workers, CSR can be made as* efficient as SSR.
CSR-SolidStart already approaches the performance of optimized SSR-ed apps by starting to load page data as soon as possible in the Back-for-Front server.
My theory is that if we install a service worker that delivers HTML without requiring any round trip to the server, we can start loading data for the requested page as fast as theoretically possible (minus the round trip to the service worker which is negligible). The installed service worker must contain maps from routes to JS and CSS bundles URLs and to URLs that trigger loader functions. When a user requests a page, the service worker should respond with something like:
So what I'm suggesting is to only use SSR and hydration for first page loads with no cache. But once the service worker cache is installed, SSR and hydration are not used anymore. Instead, simpler CSR happens.
Data loading URLs are loaded early by using preload link tags. Their inputs are sent as query parameters. My guess is that these inputs will consist only of keys that are both serializable and small.
If we go this route and if the service worker loads client side code that doesn’t support hydration, we can have some performance and code size gains, although very negligible I guess.
For reduced page load latency, client side code should be served from the edge and it should be small.
We can optimize the delivery of this code further by splitting it into code that needs to run for initial rendering and non-first-paint-critical code that is loaded later and whose job is to install event handlers and to execute non-render effects. This will require changing how SolidJS compiles its JSX and will require collaboration from the bundler to split the code correctly introducing some complexity. I think that such an optimization can get us to a very good place with little work compared to other approaches like resumability from Qwik.
2. Using the edge to cache data that is common to all users
Websites scale better the less the server is solicited and the more we can respond directly from the edge. To facilitate this, I suggest that SolidStart should provide a way to declare which loader functions are session-independent and which of them are user-specific, and that SolidStart should provide a mode where :
So these are two features that I would like to see SolidStart implement. Because I believe they will make it more efficient while not introducing too much complexity and while taking advantage of simple caching provided mostly by stable and old edge technology.
Beta Was this translation helpful? Give feedback.
All reactions