Bipin Sasi Techie, Author of the book Leadership Puzzles You can follow me on X formerly called twitter @BipinSasi No comments

Resident Instances





Instances stick around for a while after finishing their work, in case they can be
reused to handle more requests. If App Engine decides it’s no longer useful to keep an
instance around, it shuts down the instance. An instance that is allocated but is not
handling any requests is considered an idle instance.
Instances that App Engine creates and destroys as needed by traffic demands are
known as dynamic instances. App Engine uses historical knowledge about your app’s
traffic to tune its algorithm for dynamic instance allocation to find a balance between
instance availability and efficient use of resources.
You can adjust how App Engine allocates instances by using two settings: minimum
idle instances and maximum idle instances. To adjust these settings, edit your
appengine-web.xml file, and set the appropriate values in the <automatic-scaling>
section, like so:
<automatic-scaling>
<min-idle-instances>0</min_idle_instances>
<max-idle-instances>automatic</max-idle-instances>
</automatic-scaling>
The minimum idle instances (<min-idle-instances>) setting ensures that a number
of instances are always available to absorb sudden increases in traffic. They are
started once and continue to run even if they are not being used. App Engine will try
to keep resident instances in reserve, starting new instances dynamically (dynamic
instances) in response to load. When traffic increases and the pending queue heats up,
App Engine uses the resident instances to take on the extra load while it starts new
dynamic instances.
Setting a nonzero minimum for idle instances also ensures that at least this many
instances are never terminated due to low traffic. Because App Engine does not start
and stop these instances due to traffic fluctuations, these instances are not dynamic;
instead, they are known as resident instances.




You must enable warmup instances to set the minimum idle instances to a nonzero
value.
Reserving resident instances can help your app handle sharp increases in traffic. For
example, you may want to increase the resident instances prior to launching your
product or announcing a new feature. You can reduce them again as traffic fluctuations
return to normal.
App Engine only maintains resident instances for the default version of your app.
While you can make requests to nondefault versions, only dynamic instances will be
created to handle those requests. When you change the default version (in the Versions
panel of the Cloud Console), the previous resident instances are allowed to finish
their current request handlers, then they are shut down and new resident
instances running the new default version are created.

The maximum idle instances (<max-idle-instances>) setting adjusts how aggressively
App Engine terminates idle instances above the minimum. Increasing the maximum
causes idle dynamic instances to live longer; decreasing the maximum causes
them to die more quickly. A larger maximum is useful for keeping more dynamic
instances available for rapid fluctuations in traffic, at the expense of greater unused
(dynamic) capacity. The name “maximum idle instances” is not entirely intuitive, but
it opposes “minimum idle instances” in an obvious way: the maximum can’t be lower
than the minimum. A setting of automatic lets App Engine decide how quickly to
terminate instances based on traffic patterns

What is Google App Engine?

Sal Bipin Sasi
6 min read

Comments (0)

Post a Comment

Cancel