Cloud computing is not a new technology, but it is the one that has seen the most innovation, offering us services that are increasingly powerful and easy to use. Today, the mobile applications industry is growing in an accelerated way and more and more complex solutions are needed that can be solved using cloud computing.
Developers and companies have fears of using a cloud platform, one of the main ones being the price. Google Cloud offers services for the development of applications and gives us solutions with digestible prices, sometimes even for zero cost.
In this article, I’m going to analyze developers’ fears of cloud platforms and how Google Cloud mitigates them. I will explain a little about Google Cloud services that are used in application development and I will give examples of architectures. I will analyze how much it would cost to bring the aforementioned examples to production and give small conclusions about it.
Cloud computing is an abstraction of another computer, computing resource, or storage that can be accessed through the internet. Cloud providers are companies that offer cloud services. In 2006 Amazon Web Services was born; today there are different cloud providers with multiple services ranging from databases to pre-trained neural networks for different purposes.
One of the main characteristics of cloud providers is pay-per-use, meaning you only pay for what you use as if it were an electricity or water bill. Cloud providers have different prices for each of their services and some offer free layers that help us test and better choose which service most suits our needs.
The scalability is another important characteristic of cloud computing. All services are scalable.
There are some developers and companies that do not use cloud platforms for different reasons and fears. Here I am going to list some of them:
Fear of being charged for inexperience: Developers who are just entering the world of the cloud are the most likely to have this happen to them. As the services are pay-per-use, some services may incur an error in use resulting in an unexpected payment. To give an example, in cloud computing, virtual machines can be created and most cloud providers charge you for the time a virtual machine is on. If through inexperience you forget to turn off a virtual machine, at the end of the month you will have a very unexpected bill. Some cloud platforms mitigate this fear by giving free trials or free layers.
Price uncertainty: Some companies are discouraged from migrating their infrastructure to the cloud due to the difficulty they have when calculating prices. You cannot have an exact price each month, and by not having clear accounts, companies prefer to keep their in-house servers with which they feel in greater control. The amounts can be difficult to calculate, but having a cloud infrastructure saves maintenance costs, server costs, and setup costs.
Fear of insufficient security: Some companies have the false concept that the cloud is insecure or that having their servers in-house gives them control over security. The latter may be true, but it incurs setup and maintenance costs to keep your servers safe and active. Also, cloud providers take great care of the security of their services.
Now I am going to focus on Google Cloud Platform for the flexibility it gives in pricing and the services it offers to be able to develop applications.
At the time this article is written, Google Cloud offers more than ninety services, including computational resources, databases, storage, machine learning, and many others. Each of these services works as a piece that we can use in conjunction with others to build an architecture that provides a solution to a specific problem.
Google Cloud services have a similar structure that we see in this example. Google Cloud’s main service, Compute Engine, allows us to create virtual machines with different memory and processing configurations. With this example in mind, a Google Cloud service has the following components:
Unit of measurement: All services have a unit by which their use is measured. In Compute Engine, this measurement is done by memory and processing consumed in one hour.
Variable resources: Some services offer the possibility of configuring the resources to use and influence the price. On Compute Engine, the resources are memory and processing, as there are different configurations with differences in price.
Price table: This table tells us how much it will cost to use the service according to the resources chosen in its unit of measure. In Cloud Engine, we are shown the price of consuming one hour of processing and one hour of memory.
Some services may have more complicated pricing tables than others due to higher resource level and unit of measurement settings.
Google Cloud offers us a permanently free tier for different types of its services. In each of these, it offers us a limit of use per day or per month, with which Google only begins to charge us if we exceed that limit. In application development, this limit is sufficient for development, testing, and initial release without paying a penny.
In addition, for new accounts, Google Cloud offers us a $300 trial for ninety days, which is intended to be used in the learning stage but can also serve as insurance in the case of development or testing of an application that reaches the free limit of services.
Among all the services, these are the ones that are mainly used for application development:
Firestore is a NoSQL serverless database, meaning that no server needs to be configured to be able to use it. This service will help us to save and obtain the data from our applications. The main characteristic that it gives us is the synchronization of data in real-time between devices. This means that if a piece of data changes in the database, this will be reflected in real-time in all the devices where the application is open.
You can see the prices of this service here: https://cloud.google.com/firestore/pricing
Cloud storage is object storage. This service will help us to save and obtain the resources that our applications need, such as images, videos, audio, documents, etc.
You can see the prices of this service here: https://cloud.google.com/storage/pricing
Cloud AutoML offers us trained machine learning models for different uses, such as text detection and translation, image tagging and segmentation, facial recognition, etc. These functions can be exploited and used to give a great plus to our applications.
Cloud Functions is a serverless solution that allows us to build small and fast functions that are executed in specific events such as the creation of documents in Firestore, the creation of objects in Cloud Storage and HTTP requests, among others. This service makes it easier for us to implement a backend for our applications.
You can see the prices of this service here: https://cloud.google.com/functions/pricing
Cloud Run works in the same way as Cloud Functions with the difference that containers are up and running. This service is used to run larger and more complex operations and services.
You can see the prices of this service here: https://cloud.google.com/run/pricing
Firebase is a Google platform focused on application development; it works as an interface between the applications and the services described above. Firebase helps us speed up the process of integrating applications with Google Cloud. It also offers extra functionalities such as cache management and queries in offline mode.
In this section, I am going to show some examples of applications with architecture in Google Cloud with which the application could be integrated. I will also show an analysis of the possible costs of launching said architecture to a production environment.
Suppose we want to set up e-commerce for a company in which you can see products, add them to a shopping cart and make a payment through a payment gateway. The architecture can be the following:
The blue lines represent the flow of data between mobile, Firebase, Firestore, and Cloud Storage. This flow covers obtaining the data and images, which in our example can be all product data and images.
The grey lines show the payment flow. First, a Cloud Function is called to call the payment gateway API and can make the payment. The result is then saved in Firestore and returned to the application.
Using these services you have the following expenses compared to the number of users:
The image shows a linear growth in costs where there is no expense up to fifty users, including development and testing. If we go to higher numbers of users, with 10,000 users we have an approximate calculation of $40 in expenses. At this point the application should already be generating revenue per user, which would make $40 a small expense.
Suppose we want to make a small social network where users can publish text, images and document posts and also have extra functionality that obtains characteristic tags from images. The architecture can be the following:
The image shows us a flow similar to the previous example, where the post data would be saved in Firestore and all the images and documents in Cloud Storage. Google cloud offers us a service to use a trained machine learning model that obtains characteristic labels from images. In the architecture we have a Cloud Function that is activated when an image is saved in Cloud Storage, that function calls the Vision API and saves the tags in Firestore.
Using these services you have the following expenses compared to the number of users:
The image shows us the same pattern as the previous example, and in the same way at the beginning there is no expense. The difference is that the costs are higher when we have 10,000 users, we then reach $500 in expenses; this is due to the fact that the Vision API has a higher cost. Another problem that we can find here is that if we keep increasing the number of users, the costs will skyrocket uncontrollably.
This architecture can serve us for rapid development and launching of an application to the market. If we reach 500 or 1000 users and the application is well accepted in the market, we can analyze and start investing in a new architecture for our application.
The new architecture can be the following:
For this architecture, we plan to invest in creating and training our own model to obtain the image labels. Firebase gives us the ability to upload our own trained model and have the application download and use it at no additional cost. With this, we eliminate the Cloud Function and the connection to the Vision API from the architecture.
Using these services you have the following expenses compared to the number of users:
There are small but important ways to optimize your applications to make better use of Google Cloud services and consequently reduce expenses.
Good cache management: Applications must always have good cache management to reduce reads in the database and downloads of any type of file. In addition, good cache management allows the application to run faster since it does not need to always obtain data from the internet.
Query optimization: Firestore charges you for the read and write operations, so it is very important that queries are well optimized. For example, if a query is executed a second time unnecessarily, with 100 users, we would have 200 read operations, but if at some point the application scales to a million users and the error continues in the application, it would be two million read operations; twice as many read operations would be spent.
Compress resources: Cloud Storage charges you for the size of the stored files and the bandwidth used. It is highly recommended to compress files before saving them to Cloud Storage. In addition to saving space, the applications cannot support very heavy images. I recommend saving the original files only if strictly necessary.
Google Cloud offers us different services to develop scalable applications and launch them initially at no cost. This gives startups the opportunity to put their ideas into action and launch them on the market. If the application does not grow, you can abandon the idea without having incurred any expense, but if it does grow, you will have an architecture capable of growing without problem.
As for developers, Google Cloud gives us the opportunity to test their services and really become an expert in the field without spending a penny.
Compute Engine Pricing
Always free
Cloud computing
Cloud computing benefits
Cloud computing fears