January 04, 2020

Google Cloud Compute Choices


Once you have decided to build/migrate your application on the Google Cloud Platform, the first thing that would come to your mind is what are the compute choices that are available and which would be the best-suited option for the application to efficiently use the available resources. GCP offers a range of computer services that go from giving users full control (for eg., Compute Engine) to highly-abstracted (for eg., Firebase and Cloud Functions), letting Google to take care of the management and operations along the way. The following are the compute options provided by Google.

  • Compute Engine (Iaas)
    If you are comfortable with managing VM instance and want to have full control over the management of Infrastructure and DevOps, this is the best-suited option for you.
  • App Engine (PaaS - Serverless and Ops Free)
    If you want to focus on building your application and want to avoid managing overhead that comes with Infrastructure, you can opt for AppEngine. Just code and run your application on AppEngine Instance. AppEnige are of two types:
    • Standard
      You can not change a single thing in this instance. For example, if you have chosen an instance with python 2.7, you can not upgrade it later to any other version.
    • Flexible
      It provides some control over the instance. For example, if you have chosen Python 2 or Java 7 for your instance, you can upgrade the versions later to Python 3 or Java 8 whatever suits your requirement.
  • Container Engine
    It lies between IaaS and PaaS, it's a cluster of machines running Kubernetes and hosting containers running Docker, best-suited for containerized Application.
  • Cloud Functions (Fully managed and Serverless execution)
    It provides a cost-effective way to run your code. It allows you to pay only while your code runs. If you want to focus purely on code and build microservices that expose API endpoints for your applications, use Cloud Functions. Here is a detailed article on Google Cloud Functions and the beauty of serverless execution
This Picture Explains the Computes choices and the best available option for your Application. If you want to have less management overhead of Infrastructure chose from right else chose from left.

Compute Choices
 

Decision Tree


This Decision Tree will help you to decide the right compute choice for you.

  1. Are you building a mobile or HTML application?
  2. If you're building a thick client that only relies on a backend for synchronization and/or storage, Firebase is a great option. Firebase allows you to store complex NoSQL documents and files using a very easy-to-use API and client available for iOS, Android and Javascript.
  3. Are you building a system based more on events than user interaction?
  4. If you are building an event based Application that responds to uploaded files, or logins to other applications, and you want to go serverless then go for Cloud Functions. Cloud Functions allows you to write Javascript functions that run on Node.js and that can call any one of the APIs including Cloud Vision, Translate, Cloud Storage, Pubsub etc.
  5. Does your solution already exist somewhere else?
  6. Does it include licensed software? Does it require anything other than HTTP/S? If you answered no, App Engine is worth a look. App Engine is a serverless solution that runs your code on Google infrastructure and charges you only for what you use.
  7. Are you looking to build a container-based system?
  8. Do you need orchestration for your application? Kubernetes is one of the mose popular Container orchestration tool. It's a service that handles deployment, redundancy and load distribution of your containers. If you are looking for Kubernetes on GCP, you should use Container Engine.
  9. Are you looking to use GPUs in your solution?
  10. Are you building a non-Kubernetes container-based solution? Are you migrating an existing on-prem solution to the cloud? Do you need a custom kernel or arbitrary OS? If yes, you should chose Compute Engine.

 
Compute Choices