I'm using Firebase for my web apps.
It integrates with Cloud Functions to run backend code.
But I'm having issues with cold starts. And the fact that I can't keep 1 minimum instance available 24/7 is sometimes a problem.
The colds starts are fine for functions that work upon Firestore triggers, but are not tolerable for functions that will do SSR
(server side rendering) for my app or perform full text search for my users, for example.
I end up having to create cron jobs to ping them every 5 minutes in order to avoid (mostly) the cold starts. It works, but it's a pain.
I'm looking for a backend code (Node.js) alternative that will allow me to run at least a single instance of my code at all times.
At first, I've thought that App Engine would be the way to go. But it seems that I can't rewrite
to App Engine from Firebase Hosting - Rewrites. Only to Cloud Functions (which is what I'm currently doing) and Cloud Run containers.
Example:
- I need all of my routes to
rewrite
to mySSR
function/code. - I need callable functions that I'll call from my App client code that should do some calculations (sometimes access Firestore docs) and return result
I still would use Firebase authentication, storage and database (Firestore).
Should be available 24/7. I can't have cold starts.
What are my options to solve this?