react-prerendered-component icon indicating copy to clipboard operation
react-prerendered-component copied to clipboard

Cacheing with serverless

Open ScriptedAlchemy opened this issue 5 years ago • 4 comments

Have you ever used your LRU cache with a serverless application? How would you send the LRU from the main application to a render lambda?

ScriptedAlchemy avatar Jul 15 '19 17:07 ScriptedAlchemy

I would not - I'll keep lambas isolated.

I've found a simple rule to follow - cache speed should be proportional to the process it caches. If you are doing some heavy database request over the network - feel free to store result in the network memcache.

Having in mind time required to render a single component, branch or a whole App - there is no choice - local cache is the only possible option.

So - cold start, cold cache, cold render... everything is cold. And cold start should be a bigger problem than cold cache.

theKashey avatar Jul 15 '19 22:07 theKashey

What if I keep my lambdas warm? Would this work? Yeah unless you are using something like getMulti - a remote cache would be way too slow to keep up with the render. I saw this on Rapscallion before I implemented multi key prefetching

ScriptedAlchemy avatar Jul 27 '19 03:07 ScriptedAlchemy

Also, lambda vs kubernetes? I’m kind of new to serverless tech. Coming from Universal, RFR, and kubernetes clusters - Its presented something challenges. Within the react SSR context, what’s your opinion

ScriptedAlchemy avatar Jul 27 '19 03:07 ScriptedAlchemy

Cache (I mean normally) data, and use templates (ie cache templates in the local) to make the process more efficient. Bonus: no cache invalidation problem - it's gone with the every deployment.

theKashey avatar Jul 27 '19 05:07 theKashey