Cloud Run and Cloud Function are two comparable cloud computing services offered by Google Cloud Platform. When I first started using GCP, the App Engine platform was being replaced by Cloud Run. So I initially used Cloud Run to build a lot of services. Over time, I also started to utilize Cloud Functions, primarily for responding to Pub/Sub messages.
I have a personal preference for Cloud Run after using both technologies. I'll try to explain what kinds of use cases these technologies are most suited for.
It's a very nice piece of technology. Recently, I sent notifications to a certain chat group using Cloud Functions. Messages were being generated by various services and pushed to Cloud Pub/Sub topics. A Cloud Function would be started via a Cloud Pub/Sub subscription, which would then transmit those messages to a chat room.
Use Cloud Functions, in my opinion, when :-
As we are discussing Google Cloud Platform, I think I will explain various issues I faced in that regard. As there are similar offerings from other providers, I think this discussion may not apply to them.
In the previous section, I laid out some use cases for Cloud Functions. So you understand, for Cloud Functions, I am advocating for use cases that don't change very often. This is mainly because of three reasons.
This innovation was provided as an App Engine upgrade. It can be described as "Managed Kubernetes". Web services benefit most from this. Everything else will be taken care of for you; all you have to do is design a container for your web service.
Most of my services are running on top of Cloud Run. I will now lay out some use cases for this technology.
Now let's discuss what the major plus points are for Cloud Run.
So if your service can be wrapped as a container and it is handling serious production logic, I would recommend Cloud Run instead of Cloud Functions.