App engine in Google Cloud Platform (GCP)

 

What is App engine in GCP?


App Engine is a PAAS (Platform as a service) implementation in GCP. It takes our code and get that running on GCP infrastructure with auto scaling, auto healing and high performance. It works on code first approach which say’s lets not worry about infrastructure . Give me the code and let me know in which language its written. I will get that running for you. Its a fully managed serverless platform.
Types of App Engine environment in GCP

  • Standard: In this version of App engine we don’t have the flexibility to SSH into the instance. It is on demand which might scale down to zero instance as well.It supports following programming language
    • Java
    • Python
    • Node
    • PHP
    • Go
  • Flexible: We can manage the server infrastructure including scalablity feature.: It supports all the programming language and also support below
    • .NET
    • Go
    • Java
    • PHP
    • Python
    • Node.js
    • Ruby
    • Custom Runtimes

In App engine it creates a container of whole code and gets that running. It supports Python 2.7/3.7 |Java 8 |PHP 5.5/7.2 |Go 1.9/1.11 |Node.js 8

By default flexible app engine starts with 2 instance (for high availability reason but more resource means more expense :) If you want to get it running only one instance then use the

service: proxy
runtime: nodejs
env: flex

automatic_scaling:
max_num_instances: 1

Features of App Engine

    • Fully managed: Don’t need to think for infrastructure just use it.
    • Secure: Google’s security in place. Even you can’t create new file on same server through code until you have proper privilege through service accounts.
    • Support for popular languages: You can see the list of the languages for which its supported.
    • Traffic spliting: You have feature to split real time traffice percentage to different versions.
    • Monitoring, Logging and Diagnostics: In built stackdriver integration which gives great support for monitoring, logging and diagnostics
    • Application security: Its provides HTTPS with firewall rules by default at no additional cost.
    • Service Ecosystem: It provides ecosystem for different services all can be of different languages.

Application deployment in APP engine


You can deploy any application to GCP’s app engine with a single command on SDK.

gcloud app deploy

In order to run this command, you need to take care few things.
You project should be configure properly on GCP SDK (use command gcloud init for same)
Make sure you have app.yml file present on the root of the project and its well written including scaling and others (You can use any file name like my-custom-file.yml but in this case your command would be gcloud app deploy my-custom-file.yml)
In case you have any dependency then composer/any dependency file should be there and it should have all the dependencies properly declared.

Application scaling in App engine


By default App Engine scale up/down based on your load on the server. The instances which runs under the app engine are of two types.
1.Dynamic : Which starts up and shut down on need basis
2.Resident : Which runs all the time and improve system performance.
Both dynamic and resident instance instantiate the code included in app engine service version

There are three types of scaling in App Engine.
Manual : Where instances will be resident instances. It will keep on running irrespective of load level. Can either running or stop.
Basic : Where Services use dynamic instances. Here instance is created when the application receive the request. And turn down if application gets idle. This is ideal for the work that is intermittent or driven by user activity. Can either running or stop.
Automatic: Where Services use dynamic instances. It creates the instances based on application metrics (e.g., request rate, response latency, minimum idle instances, minimum resident instances etc.) . This is always running.
By default app engine instances gets charged hourly basis. But you can send limit by setting a spending limit.

Why App Engine is not best for containers


Although App engine supports custom containers to run an application still app engine shouldn’t be a best option for containerization. Below are some of the reasons for same:
App Engine is good if you have only one container.
Application is not portable anymore (or require changes to be made)
If you want stateful containers you can’t do with App engine flex.
Difficult to manage complex micro services under it.

Related posts:

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video... Read More about Chandra Shekhar

Latest posts by Chandra Shekhar (see all)