Choose between standard and flexible App engine on GCP

Before going to deeper into details of choosing right environment, first of all we should know app engine works
“When we deploy an application then it creates a container and deploy it either on lightweight instance (for standard) and compute instance (for flexible)”

Choose between standard and flexible App engine


If you are going to choose app engine for your application deployment. Then you must have to decide if we should go for standard/flexible environment.This decision should be based on certain points.

Time to scale up or down:

In Standard environment, application runs  on lightweight instance on sandbox. So it response quickly and scaling will be quite fast even from zero to thousands in few seconds. Whereas in flexible containers runs inside the Google’s compute engine VM. So it can be customized more (network configuration can be added, you can ssh into instance) but scaling might take more time as compared to standard environment.

Health check:

Standard environment doesn’t use health check to determine whether or not we should send traffic to instance.Since it allow certain memory and CPU so based on their own algorithm they decide when to spin up a new machine. In case of flexible instance it allows to write custom health check and redirect traffic based on that as well (although that is very careful task)

Overload scenario:

In standard environment, if there is overload on the server then it drop certain request in order to avoid cascade failure (and spin up new instances). So its recommended that we should use flexible environment for high QPS apps. in Flexible environment to handle overload we should use following best practices:-

*. Limiting the number of concurrent request (Java apps using the Jetty runtime that can configure the Quality of Service Filter to implement drop overload. You can use this feature to set the maximum number of concurrent requests serviced by the apps, and the length of time that requests will be queued using this feature in order to manage more efficiently)

*. Should ensure that health check is not being performed during overload

*. Should have another version running and split traffic gradually

Single Zone failure:

In standard environment, all the instances are hosted on single zone and in case of zone failure, the application starts new instances on another zone in same region and load balancer will route traffic to new zone. In flexible case instances are hosted on regional managed instance group so these are not in one availability zone so in case of one zone failure, health check will work and all load will get distributed to different zone and because of auto scaling it will spin up other machines there.

Cost:

by the way cost is based on resource consumed in both (standard and flexible ) like CPU, QPS, Memory, Network etc.

In standard environment even you will make changes in machine in order to see what is the changes happned you will get to know after daily cycle. but in flexible environment  you can do experiment so see if cost has any impact or not if you are changing resources.

Microservices

Standard environment allows secure authentication between applications using the X-Appengine-Inbound-Appid request header. But in Flexible environment does not have such a feature. The recommended approach for secure authentication between applications is to use OAuth.

Conclusion


Conclusion: Use GAE standard if you want to serve HTTP request quickly. Use GAE flex if you need more advance operation which might require CPU intensive, Memory intensive, Network intensive etc. Its not a lightweight application intead its a heavy application.

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)