问题
After reading the docs on both Cloud Run and Firebase Cloud Functions, I have a few questions I want to clear up:
Does Cloud Run basically act as a container image storage/deploying mechanism? If I have 2 websites and have them as separate containerized images, does Cloud Run just deploy the specified one given the trigger?
Integrating Cloud Run with Firebase Cloud Functions as the trigger, will there be an additional layer of latency? While latency times are never known, FCFs inherently have warm-up times due to cold starts, will there be added latency due to Cloud Run cold-starting the images?
Does the Cloud Run images travel through the FCF to get to the user. Or does FCF merely redirect the user directly to the Cloud Run image?
Basically, is it like
Client -> FCF -> Image -> FCF -> Client
or
Client -> FCF -> Image -> Client
回答1:
Typically on Stack Overflow one is supposed to limit to one question per post (to avoid being closed as "too broad"), but I'll try here. Please address followup questions as new posts.
Yes, it is just a containerized way of serving HTTP requests.
Cloud Run is not directly related to Cloud Function except where you write code to connect them. If you write a Cloud Function trigger that proxies to Cloud Run, it will incur all the latency costs of both products, as required (not all invocations require a cold start). All "serverless" compute options have a cold start time, since they all scale down to zero (based on current load), and you don't pay for virtual server instances to be allocated and immediately available all the time.
Again, they are not related. You can use either one without the other.
来源:https://stackoverflow.com/questions/58548947/implementing-cloud-run-with-firebase-cloud-functions