Focus on code over infrastructure with Google App Engine Flexible Environment

The Google App Engine Flexible environment, which transitioned from Beta to GA a couple of months ago allows developers to focus on doing what they do best, writing code. Based on Google Compute Engine, the App Engine flexible environment automatically scales your app up and down while balancing the load.
 
Microservices, authorization, SQL and NoSQL databases, traffic splitting, logging, versioning, security scanning, and content delivery networks are all supported natively. In addition, the App Engine flexible environment allows you to customize the runtime and even the operating system of your virtual machine using Dockerfiles.
 

While its predecessor, Google App Engine Standard environment had previously only offered Python, Java , Php and Go options, the Flexible environment now offers further language options including Node.js, Ruby, and .NET.
 
On top of extra language options of course, the flexible environment also offers a host of other bells and whistles making things for developers much easier including ..
 

Instance scaling

While an application is running, incoming requests are routed to an existing or new instance of the appropriate service/version. The scaling type of a service/version controls how instances are created. Scaling settings are configured in the app.yaml file. There are two scaling types:

Manual scaling

A service with manual scaling runs continuously the exact same number of instances irrespective of the load level. This allows tasks such as complex initializations and applications that rely on the state of the memory over time.

Automatic scaling

Automatic scaling is based on request rate, response latencies, and other application metrics.

 

Monitoring resource usage

The Instances page of the Cloud Platform Console provides visibility into how instances are performing. You can see the memory and CPU usage of each instance, uptime, number of requests, and other statistics. You can also manually initiate the shutdown process for any instance.

Logging

When you write to stdout or stderr, entries appear in the Cloud Platform Console Logs page.

 

Communication between services

Services can communicate with other services and external applications in various ways. The simplest approach is to send HTTP requests to a service by including its name in the URL: <service-name>.app-id.appspot.com. If you require secure communication between services, you can authorize requests.

Services can also communicate via Cloud Pub/Sub. Pub/Sub provides reliable asynchronous many-to-many messaging between processes, including App Engine. These processes can be individual instances of your application, services, or even external applications.

Services and external applications can also share data stored in databases such as Cloud Datastore, Cloud SQL, or third-party databases.

 

Node.js

Recently at Boyle Software we had the opportunity to use Google App Engine Flexible on a project for one of our clients (Vroom.com) and found it quite nice to work with. We were especially excited about using it’s new Node.js option..

The Node.js runtime is the software stack responsible for installing your application’s code and its dependencies and running your application. The standard runtime is declared in app.yaml as runtime: nodejs:


Runtimes in the flexible environment are built using Docker. 

Engines

The default Node.js engine aims to be the latest LTS release. You can specify a different Node.js version in your application’s package.json file by using the engines field.

The following example configures the runtime to use the latest Node 8 release.

Dependencies

During deployment, the runtime can use either npm or yarn to fetch and install the dependencies declared in your package.json file. By default the runtime uses npm install, but if a yarn.lock file is present, the runtime will use yarn install instead. If you want to force the runtime to use npm, you can list the yarn.lock file in the skip_filessection of your app.yaml file.

Application startup

The runtime starts your application by using npm start, which uses the command specified in package.json. For example:

Your start script should start a web server that responds to HTTP requests on the port specified by the PORTenvironment variable, typically 8080.

 

Get started with Google App Engline Flexible environment today here:  https://cloud.google.com/appengine/docs/flexible/

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.