GCP : APP Engine vs Cloud Run(cost comparison)
This article discusses cost comparison for Microservices with a very high volume of API calls deployed on APP engine and Cloud Run..
The use case for comparison:
1. Our API is going to receive a very high volume of rest calls let's say 30 million in a month.
2. Each request is going to take 500 ms(approax) to process on the server.
App Engine
We took F1 instance type in App Engine for our service in our experiment, wrote a simple hello world API in python(Flask), and sent almost 35,000 API calls on it.
It tool 12.12 instance hours to process these requests. So. on average 2887 requests get processed for each instance hour.
Now in our use case, we are going to receive 30 million requests in a month, 1 million each day.
instance hours consumed to process 1 million requests (1million/2887) are 346, so instance hours consumed by 30 million requests in a month are 10380.
Now GCP will charge us on10220 instance hours after deducting free quota(for F1 instance type 28 instance hours are free per day ).
So the estimated cost for GCP APP Engine to process 30 million records is $368.44 per month.
Cloud Run
Created a service with 1 CPU and 256 MB of memory to handle 150 concurrent requests per instance, each of 500 ms execution time (approx) , with 5 minimum number of required instances.
Now as per our use case 30 million total requests to be processed, the estimated cost for this provided by GCP is $52.26 per month.
Conclusion
From the above cost estimations, Cloud Run seems to be a better service for Microservices with a very high volume of API calls.