In this article, we are going to see about what is Instance groups and how you can use instance groups to manage a group of virtual machine instances.
Instance group allows your applications to gracefully handle increase in traffic as well as it reduces the cost when the need for the resource is lower. And we will see about types of instance groups and the features of instance groups in this article.
Let’s get into this article and learn about Instance groups in Google Compute Engine. Stay tuned here, we will keep publishing a lot more articles on Google Cloud.
What is Instance Groups?
Instance group is nothing but a group of virtual machine instances managed as a single entity. You can manage groups of similar VMs having similar life cycle as one unit and you can create two types of Instance group in Compute Engine.
- Managed instance group
- Unmanaged Instance group
Managed Instance group (MIG)
These are identical virtual machine created using instance template. So these VMs, which are part of managed group will have same machine type, same image and the same configuration.
Some of the features that are provided for the managed instance group include auto scaling based on the number of users using the instance group, you can scale the number of compute instances up and down.
Managed instances also provide a auto healing. You can configure a health check, and if the health check fails that specific instance would be automatically replaced with a new instance.
Another important features of MIG is managed releases. In this you can go from one version to another version without any downtime.
Important Features of MIG
- It can maintain a certain number of Instances.
Example: If In case any one of the instances in the instance group fails, the managed instance group will replace that instance with a new instance. Therefore if an instance crashes, the managed instance group will launch another instance.
- It can detect application failures using health checks. So basically you can configure a health check on the application which is deployed on your instance. And if the health check fails, that instance will be replaced by a new instance.
Feature Name: Self Healing
- You can also increase and decrease the number of instances that are part of your managed instance group, based on the number of users using the application.
Feature Name: Auto Scaling
- You can also add a load balancer attached to your managed instance group to distribute load among the different virtual machines that are part of your management group.
Feature Name: Load balancer
- And if you are creating regional managed instance groups, then you can distribute the instances across multiple zones. This gives you higher availability. So regional managed groups provide higher availability compared to zonal MIGs.
Feature Name : Regional MIGs
- The other important feature of managed instance group is that you release new application versions without downtime.
Feature Name: Rolling Updates
Managed Instance groups are maintained by Compute Engine and it will specify the instance template based on the configuration for scaling purposes.
Advantages of using Managed Instance groups
Managed Instance groups offer:
- High Availability – High availability consists of Regional coverage, Auto healing, and load balancing to distribute the traffic.
- Scalability – Managed Instance group automatically scales the number of instances according to their demand and scales down to reduce the costs.
- Automatic updates – It consists of rolling updates and canary deployment. It helps to update the instances without disrupting the service.
- It also supports stateful workloads
Unmanaged Instance groups
In these unmanaged instance groups, you can have VMs with different configurations, different images, or VMs with different hardware. So if you want to group VMs with different kinds of configurations then you can create an unmanaged instance group.
The important thing in the unmanaged instance group is you do not get any of the features like auto-scaling or auto-healing. Only the managed instance groups that basically have identical VMs which are created using an instance template have the features of auto-scaling and auto-healing.
Then. the next thing is unmanaged instance groups are not recommended unless you need different kinds of VMs.
Overview of Instance groups
In the below screen, you can see the stateless and stateful types for managed instance group.
Stateless managed instance group supports
- Autoscaling, auto-healing and auto-updating
- Supports multi-zone deployment
- Load balancing
Stateful managed instance group supports
- Disk and metadata preservation
- Auto healing and updating
- Multi-zone deployment
- Load balancing
Auto healing proactively identifies and replace the unhealthy instances, the ones that are not responding with the healthy one. For Autohealing you need to create a health check, which not only detects whether the machine is running or not but also detects application-specific issues such as freezing, crashing, and overloading.
In the below screen you can see the health check image of the instance group.
It is a fully distributed, software-defined solution that balances user traffic to multiple backends to avoid congestion and ensure low latency. There are different types of Load balancing depending on the type of traffic. They are
- HTTP(S) Load Balancing
- TCP Load Balancing
- UDP Load Balancing
Load balancer distributes incoming traffic across multiple VM instances to help your application be scalable.
Advantages of Global Load Balancing
- Cross-Regional failover
- Fast Autoscaling
- Scales upto 1 million queries per second
The location of the instance group can be either zonal or Regional. You can create it in specific zone or you can specify the instance group to distribute the instances across different zones in a specific region.
Obviously, Regional is recommended because it gives you higher availability.
Therefore, In this article we have seen about instance groups and the features of managed instance groups as well as unmanaged instance groups. I hope this article will help you in getting started with Instance groups in Google compute Engine.
In the next article will see about how to create instance groups in Google Compute Engine and also we will publish a lot more articles on Google Cloud. Till that stay tuned for more articles!