Managing Instance Groups on GCP ||

An instance group is a collection of virtual machine (VM) instances that you can manage as a single entity.
Compute Engine offers two kinds of VM instance groups, managed and unmanaged:

1. Managed instance groups (MIGs) let you operate apps on multiple identical VMs. You can make your workloads scalable and highly available by taking advantage of automated MIG services, including: autoscaling, autohealing, regional (multiple zone) deployment, and automatic updating.

2. Unmanaged instance groups: let you load balance across a fleet of VMs that you manage yourself.

Managed instance groups (MIGs)

Use a managed instance group (MIG) for scenarios like these:

1. Stateless serving workloads, such as a website frontend.
2. Stateless batch, high-performance, or high-throughput compute workloads, such as image processing from a queue.
3. Stateful applications, such as databases, legacy applications, and long-running batch computations with checkpointing.

Compute Engine maintains each of the MIG's managed instances based on the configuration that you specify in an instance template and optional stateful configuration.

Benefits

MIGs offer the following advantages:

1. High availability:

A. Automatically repairing failed VMs. If a VM in the group stops, crashes, gets preempted (Spot VMs), or is deleted by an action other than an instance group management command (for example, an intentional scale in), the MIG automatically recreates that VM in accordance with the original instance's specification (same VM name, sample template) so that the VM can resume its work.

B. Application-based autohealing: You can also set up an application-based health check, which periodically verifies that your application responds as expected on each of the MIG's instances. If an application is not responding on a VM, the MIG automatically recreates that VM for you. Checking that an application responds is more precise than simply verifying that VM is up and running.

C. Regional (multiple zone) coverage: Regional MIGs let you spread app load across multiple zones. This replication protects against zonal failures. If that happens, your app can continue serving traffic from instances running in the remaining available zones in the same region.

D. Load balancing: MIGs work with load balancing services to distribute traffic across all of the instances in the group.

2. Scalability: When your apps require additional compute resources, autoscaled MIGs can automatically grow the number of instances in the group to meet demand. If demand drops, autoscaled MIGs can automatically shrink to reduce your costs.

3. Automated updates: The MIG automatic updater lets you safely deploy new versions of software to instances in your MIG and supports a flexible range of rollout scenarios, such as rolling updates and canary updates. You can control the speed and scope of deployment as well as the level of disruption to your service.

4. Support for stateful workloads: You can use MIGs for building highly deployments and automating operations of applications with stateful data or configuration, such as databases, DNS servers, legacy monolith applications, or long-running batch computations with checkpointing. Stateful MIGs preserve each instance's unique state (instance name, attached persistent disks, and metadata) on machine restart, recreation, auto-healing, and update events.



Automatic repair and autohealing

Managed instance groups maintain high availability of your applications by proactively keeping your instances available. A MIG automatically repairs failed instances by recreating them.
You might also want to repair instances when an application freezes, crashes, or runs out of memory. Application-based autohealing improves application availability by relying on a health checking signal that detects application-specific issues such as freezing, crashing, or overloading. If a health check determinesan application has failed on a VM, the group automatically recreates that VM instance.

Health checking

The health checks used to monitor MIGs are similar to the health checks used for load balancing, with some differences in behavior. Load balancing health checks help direct traffic from non-responsive instances and toward healthy instances; these health checks don't cause Compute Engine to recreate instances. On the other hand, managed instance group health checks proactively signal to delete and recreate instances that become UNHEALTHY.

For the majority of scenarios use separate health checks for load balancing and for autohealing. Health checking for load balancing can and should be more aggressive because these health checks determine whether an instance receives user traffic. Because customers might rely on your services, you want to catch non-responsive instance quickly so you can redirect traffic if necessary. In contrast, health checking for autohealing causes MIGs to proactively replace failing instances, so this health check should be more conservative than a load balancing health check.

Regional or zonal groups

You can create two types of MIGs:
1. A zonal MIG, which deploys instances to a single zone.
2. A regional MIG, which deploys instances to multiple zones across the same region.
Both types offer all of the advantages of MIGs. Regional MIGs add higher availability by spreading application load across multiple zones, which protects your workload against zonal failure, and regional MIGs offer more capacity, with a maximum of 2,000 instances per regional group.

Load balancing
Google Cloud load balancing can use instance groups to serve traffic. Depending on the type of load balancer you choose, you can add instance groups to a target pool or to a backend service.

Autoscaling:
MIGs support autoscaling that dynamically adds or removes VM instances from the group in response to increases or decreases in load. You can configure an autoscaling policy to specify how you want to scale the group. In your autoscaling policy, you can set one or more signals to scale the group based on CPU utilization, load balancing capacity, Cloud Monitoring metrics, schedules, or, for zonal MIGs, by using a queue-based workload like Pub/Sub.

Automatic updating:
You can easily and safely deploy new versions of software to instances in a MIG. The rollout of an update happens automatically based on your specifications: you can control the speed and scope of the update rollout in order to minimize disruptions to your application. You can optionally perform partial rollouts, which allows for canary testing.

Support for stateful workloads:
You can build highly available deployments of stateful workloads on VMs using stateful managed instance groups (stateful MIGs). Stateful workloads include applications with stateful data or configuration, such as databases, legacy monolith applications, and long-running batch computations with checkpointing.
You can improve uptime and resiliency of such applications with autohealing, controlled updates, and multi-zone deployments, while preserving each instance's unique state, including customizable instance name, persistent disks, and metadata.

Groups of preemptible instances

For workloads where minimal costs are more important than speed of execution, you can reduce the cost of your workload by using preemptible VM instances in your instance group. Preemptible instances last up to 24 hours, and are preempted gracefully-your application has 30 seconds to exist correctly. Preemptible instances can be deleted at any time, but autohealing will bring the instances back when preemptible capacity becomes available again.

Containers:

You can simplify application deployment by deploying containers to instances in managed instance groups. When you specify a container image in an instance template and then use that template to create a managed instance group, each VM is created with a container-optimized OS that includes Docker, and your container starts automatically on each VM in the group.

Network and subnet
When you create a managed instance group, you must reference an existing instance template. The instance template defines the VPC network and subnet that member instances use. For auto mode VPC networks, you can omit the subnet; this instructs Google Cloud to select the automatically-created subnet in the region specified in the template. If you omit a VPC network, Google Cloud attempts to use the VPC network named "default".

Comments

Popular posts from this blog

The Morph Concept in 2025: From Vision to Emerging Reality

Mortgage Train 2025

Web Train 2025: Locomotives