The Google Cloud Platform: Cloud Function vs App Engine vs Compute Engine

Nowadays, The Cloud is a promising technology, and most frequently adopted as a solution for the issues of traditional infrastructure. For instance, the cloud offers flexibility in terms of cost savings that is not available in a traditional infrastructure. With the cloud, you only pay for what you use. That means you don’t pay for anything you don’t need, or simply don’t use. This is really helpful for a small company that needs to ramp up its business. With a traditional infrastructure, you have to pay for the server whether you use it or not. However, with the cloud, the cost is entirely dependent on what you actually use.

When you are looking at your options for utilizing the cloud there are three main companies that come to mind: Amazon Web Services, Microsoft Azure, and Google Cloud Platform (GCP). We utilize one of these major cloud providers for the backend of one of our websites called Rentalios. The provider that we decided to use was the Google Cloud Platform. Interestingly, Google Cloud Platform (GCP) has several engine variants to use for the backend. As we quickly discovered, using the right engine can optimize performance, price, and specifications. That is why we decided to experiment with the three types of engines and determine which is the best for our company and our needs.

Rentalios

Before we get into the experiment, here is some information on the Rentalios platform:

The Rentalios system has a function in viewing and predicting property prices based on location data and similarity attribute data.

The Rentalios dataset covers almost all big countries in the world

The amount of data growth is more than 3 thousand per day.

Currently, the Rentalios System uses Google Cloud Function as a backend, and we found some problems with the automatic scaling up feature. The system goes down regularly as part of the GCP management which can lead to side effects when Google has to create a new container for a new request. This process needs extra time to process a hit on the first request after some idle time; this process is commonly called a cold-start. For the purpose of maintaining the execution time and knowing the best engine option for the Rentalios predict function, in this experiment, we tried to implement the Rentalios function on 3 different types of engines provided by the Google Cloud Platform.

The Experiment

We are using crontab by making a call request into the predict function that has been set up on 3 types of engines plus Cloud Function:

app engine

compute engine small machine

compute engine medium engine

This experiment is done by scheduling the crontab for calling the predict function API is done 3 times sequentially every 1 hour and each type of engine. We also recorded the area called, response code, and execution time and set the area to be selected as a parameter when calling the API.

The areas we selected are:

Address 1 = 94303

Address 2 = 90201

Address 3 = California

Address 4 = 94131

Address 5 = Baltimore

Address 6 = Green Bay

Experimental Result

After doing the experiment we found no errors at all API calls. The following is a summary table of the execution time of each engine and the sequence of the API call:

Table 1 summarizes execution time from different engines in every sequence call.

From Table 1, it can be seen that the app engine and cloud function have the same cold start pattern. It takes longer to process the first call after being idle for a while, whereas on the compute engine, we get more stable results for the execution time of each sequential call using a small machine or medium machine. In the summary comparison of engines, we can see in table 2:

Table 2 summarizes execution time from different engines

Table 2 reinforces the conclusion that using a computer engine can maintain performance and eliminate cold start problems. With compute engine, results get the fastest average in executing the predict function of Rentalios. Additionally, the selection of specifications from the compute engine does not significantly affect the performance of the predicted function.

In conclusion, when selecting between Cloud function, App Engine, and Compute Engine, Compute Engine is the best in performance.