0

we have two VM instances running in Google Compute Engine. The first one is running NodeJs instances that connect to a mongodb server installed on the second VM instance. Those have CPU higher running most of the time around 70%.

I would like to add autoscaling to these instances in order to improve the performances but I don't want to reinstall the instances completely and to keep the public and internal ip adresses if possible.

If I am right, I have to create a new group instance and add the two existing instances to it.

My questions are the following:

  1. Will it keep my instances running and with the same IPs, firewall settings... ?
  2. Is it the right way to proceed or is there a way to just increase the CPU of my existing instances as required?

Thank you for your answers.

vpx
  • 133
  • 7

1 Answers1

1

Autoscaling feature of managed instance groups is usually applicable to stateless VM instances. An autoscaler adds or removes instances from a managed instance group. Therefore, any data stored on root disks of VMs can be lost.

For your NodeJs VM, you can use autoscaler if it's a stateless VM. However, for MongoDB VM one option is upgrading the machine type of your VM and increase the processing resources to accommodate your workloads. This is called Vertical Scaling. Another option is implementing the Horizontal Scaling through sharding feature of MongoDB.

About your other questions:

To keep your IP external address, if it's an ephemeral one you can promote it to a static external IP address and assign it to the forwarding rule of a HTTP(S) load balancer. The load balancer will distribute user requests among your NodeJs VM instances (Backends).

Your GCE firewall rules might need to be modified to comply with Load balancer requirements.

Kamran
  • 1,415
  • 7
  • 16
  • Thanks a lot sounds clear to me regarding the MongoDB VM but not enough yet regarding the nodejs one. Will have a look at it. Thanks – vpx Oct 10 '17 at 16:19