2

I am new to Google compute engine and I am try to setup network load balancing having 2 VMs for serving web pages.

For ex, I have 2 VMs - app1 and app2 - both having apache server and serves simple web page.

Both VMs are running with Red Hat Enterprise Linux Server release 7.0 (Maipo)

I am able to access both web pages through the IP in browser.

I created network load balancing setup and both apps are showing in green in target pool which means load balancer is able to connect to both VMs.

But, when I hit the IP of load balancer, it is rendering page from only one server. If I manually stop the server in the VM, load balancer IP redirects to other app. I believe load balancer is able to identify health of both VMs and able to redirect.

But it is not balancing the traffic. Can anyone help me to solve this issue?

Blaszard
  • 30,954
  • 51
  • 153
  • 233
Saravanan S
  • 1,021
  • 1
  • 10
  • 24
  • Have you confirmed session affinity while creating the target pool? – Faizan Dec 23 '14 at 23:44
  • I didn't want to start with session affinity for the initial setup, so didn't enable that. As per documentation, if I have enabled session affinity with client IP, then this is correct. but without session affinity, it should be going to both VMs in round robin. – Saravanan S Dec 24 '14 at 02:33
  • I think network load balancer doesn't forward the traffic on round robin bases. I was able to test it with the load balancer setup that I have. As per the document "By default, to distribute traffic to instances, Google Compute Engine picks an instance based on a hash of the source IP and port and the destination IP and port." [1] https://cloud.google.com/compute/docs/load-balancing/network/ – Faizan Dec 24 '14 at 02:46
  • Oh. that might be a reason. But as per the video they have provided, it was supposed to do round robin balancing. I applied session affinity now and it seems to be working as expected. – Saravanan S Dec 24 '14 at 03:15
  • I will post my comment as an answer so that you can accept it which might help someone else with the similar issue. – Faizan Dec 24 '14 at 03:48

2 Answers2

3

I think that the network load balancer doesn't forward the traffic on a round-robin basis. I was able to test it with the load balancer setup that I have. As per the documentation:

By default, to distribute traffic to instances, Google Compute Engine picks an instance based on a hash of the source IP and port and the destination IP and port.

Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
Faizan
  • 1,937
  • 13
  • 18
0

HTTP/S load balancing will proxy requests in a round-robin fashion. https://cloud.google.com/compute/docs/load-balancing/http/

Matt S.
  • 7,651
  • 3
  • 19
  • 12