Google App Engine
Authors: Pranesh Kulkarni; Shubham Deshmukh; Sakshi Kulkarni; Tejas Rajuskar
Google App Engine (GAE) is a platform as a service (PaaS) solution for the development and deployment of web applications on the Google Cloud Platform (GCP). PaaS is a cloud computing model for the development and deployment of simple cloud-based applications to cloud-based enterprise applications. It provides infrastructure which includes servers, storage, network as well as operating systems, middleware, development tools, database management systems (DBMS), analytical solutions, etc. In the PaaS model, users don’t need to worry about maintenance, set-ups, patching, security everything is managed by a cloud vendor. This allows for the fast development of an application.
Google app engine is a fully managed serverless environment that also offers load balancing and autoscaling. Depending upon the number of requests made by users to the application, it adds or removes the resources allocated for the application. So a developer can just focus on development and user experience.
In this environment, the user just needs to upload the docker image to the cloud with a couple of commands, then everything will be managed by google including the setup, resource allocation, domain creation, hosting, etc. After deployment, the application will run on container-based instances.
Components of a GAE application:
When you create an application on GAE you actually create an application resource. This is the top level of the GAE hierarchy. This top-level container includes services, versions, and instances of your application. Each google app engine application includes at least one service which can have multiple versions. But there is actually a certain limit for that. You can create a maximum of 5 services and 15 versions per application for a free app and 105 services and 210 versions per application for a paid app.
The next level of the hierarchy consists of services which can be logical components that allow the developer to decompose the larger application into small independent components. Each component will be responsible for specific tasks. These services in the application can securely share GAE features or resources such as Cloud Datastore, Memcache, etc., and can communicate with one another. Generally, the GAE services work like microservices. So, you can develop and deploy multiple services to run as a set of microservices.
Each service in a GAE application includes source code files and configuration files (which might be different for different services in a single application). All those files compose a single version corresponding to that service.
Every time you enter a deploy command to that service you create an additional version to that service. App Engine allows you to quickly switch between different versions of the service which can be beneficial for rollbacks and testing. You can also route the traffic to one or more versions of your service.
The version associated with the service runs on one or more instances. These instances which are basic building blocks of the app engine fall at the lowest level of the hierarchy. Depending upon the load and scaling type, GAE scales up the number of instances for consistent performance or scales down the number of instances in order to reduce the costs.
The following figure illustrates the hierarchy of a Google App Engine application
Scaling in GAE
In order to control how and when instances should be created or removed, you should specify the scaling type. This setting should be specified in the configuration file which can be different for different versions of different services. Currently, GAE supports three types of scaling.
1. Automatic Scaling
In this scaling type, instances are created or removed depending upon the number of requests or request rate, or other application metrics. In configuration files, you can specify the threshold of those matrics to scale up and scale down instances. You can also set the minimum number of instances to be running in order to deliver consistent performance.
2. Basic Scaling
On receiving requests, basic scaling creates instances and on becoming idle, it shutdowns each instance. This scaling option allows you to set the maximum number of instances.
3. Manual Scaling
In manual scaling, a developer needs to specify the number of instances for each version in the corresponding service’s configuration file. These instances will run continuously regardless of the load on the application. GAE provides API functions to manually adjust the number of instances quickly without stopping other instances.
App Engine environments
While deploying the application in GAE, you can choose between App Engine Standard or Flexible Environment. Both have their own benefits and limitations so you can choose them according to the workload.
In the Standard environment, you must have to publish the application with predefined instance classes such as F1, F2, F4, and so on. Each of them has different memory and CPU configuration. But you must have to choose these sets of configurations only. Application instances of this environment run in the sandbox using the runtime environment of the supported language. There are limited versions of supported languages available in this environment. The standard environment charges you based upon the instance running hours but this enables faster deployment. Zero scaling is also possible with all three scaling types. But these fully managed environments don’t give you SSH access to the VMs neither it allows you to modify the runtime. So the development flexibility is less compared to App Engine Flexible Environment.
In the App Engine Flexible environment, instances run in Docker based containers on Compute Engine virtual machines (VM) that are managed by the team using this environment. This environment allows you to run your application with custom runtimes. This feature not only allows you to modify the runtime but also gives you SSH access to VMs. But this feature slow downs the deployment time as well as instance startup time. This environment scales up or scales down the computational power depending upon the load but zero scaling is not possible. Unlike the standard environment, in this environment users are charged based upon CPU and memory usage.
Supported Languages and runtimes
Google app engine currently supports 7 programming languages:
If you are using an App Engine flexible environment, then you can write your code in any version of any programming language. But if you want to deploy your application in the App Engine Standard environment, then there are some limitations to using the runtime version.
The following table shows programming language versions supported by Google App Engine Standard Environment.
Fully managed Environment
In a fully managed environment of GAE, you can just focus on your code, the rest of the things including infrastructure, maintenance, and set-ups will be managed by google.
Powerful application diagnostics
In GAE there are some features available such as Cloud Logging and Cloud Monitoring for monitoring the health and performance of the server or application. By using Cloud Debugger and Error Reporting tools, you can detect and fix the bugs in your application.
As mentioned earlier, GAE allows you to build your application in 7 popular programming languages such as Node.js, Ruby, Java, .NET, Python, Go, or PHP
You can create and host different versions of different services of an application. This allows you to create development, staging, test, and production environments.
You can define some access rules by using the App engine Firewall and leverage managed SSL/TLS certificates at no additional cost.
Diverse Set of APIs and services
GAE has a diverse set of APIs that allows developers to build, develop and manage their applications. This includes URL Fetch API, User API, Memcache API, Channel API, XXMP API, File API, etc. You can always take the benefits of the growing ecosystem of Google Cloud services to enhance the performance and user experience of your application.
Pricing models are different for the standard environment and flexible environment
App Engine charges you on daily basis for the resources that your application consumes. There is a free usage quota available in GAE above which you will be charged as per the standard rates. Although the charges are calculated every day but the billing amount will be debited on the first day of the next month by summing up all the daily charges. You can see the billing data on the app engine dashboard.
App Engine standard environment pricing:
In the standard environment, you will be charged based on instance hours. You also need to pay for the network resources. You will be charged $0.12 per GB for outgoing network traffic. The following table illustrates hourly billing rates for different instance classes (Rates in Los Angeles Datacenter).
App Engine Flexible Environment pricing:
Unlike a standard environment, in a flexible environment, you will be charged for the CPU and Memory resources that your application actually consumes. The following table summarises the billing rates for the app engine flexible environment (Rates in Los Angeles Datacenter).
App Engine vs Compute Engine
Google app engine is a PaaS offering that delivers fully managed VM instances for deploying or hosting web applications while Google Compute Engine is an IaaS offering that delivers highly configurable virtual machines which can handle any workload. The basic difference between both solutions is flexibility and pricing. Google Compute Engine allows you to perform any compute job you want. It provides you root access to your VM. But the app engine gives you less control over computing resources. It won’t provide you root access (you can enable that in a flexible environment) and you need to build your application in a specific language only. Rates of resources are also high compared to Compute Engine. But in terms of scaling time and deployment time, App Engine is a clear winner. It also provides a fully managed environment and development toolkit specifically required for application development which Compute Engine doesn’t. When you use compute engine you need to configure everything including setups, patching, runtime creations, logging, and reporting. So depending on your workload, you should choose the right one.
Google App Engine vs AWS Elastic Beanstalk vs Azure App Service
Now let’s compare between biggest competitors of the Google App Engine. The following table shows the comparison between the Google App Engine, AWS Elastic Beanstalk, and Azure App Service.
We have recorded one video for deploying the python app on the google app engine. Here we’ve deployed one simple python based flask application on Google App Engine Standard Environment.
So in this blog, we have covered almost every aspect of the Google App Engine. We have pointed out some interesting features of the App engine as well as some offered services. We have compared different environments, different compute options, and different cloud service providers and at last, we have demonstrated the app engine deployment procedure.
Thank you for visiting our blog, you can write your opinion on Google App Engine in the comment box….