Benchmark Google Load Balancer
When you configure a public loadbalancer at Google Cloud you provide 2 solutions, STANDARD and PREMIUM.
The documentation is pretty clear HERE
Intro
For doing this benchmark, I setup 2 Network Service Tier, one standard and another one premium.
resource "google_compute_backend_bucket" "hugo" {
name = replace("${var.domain_name}", ".", "")
bucket_name = google_storage_bucket.hugo.name
enable_cdn = false
}
resource "google_compute_address" "hugo" {
name = replace("${var.domain_name}", ".", "")
network_tier = "STANDARD"
}
resource "google_compute_url_map" "hugo" {
name = replace("${var.domain_name}", ".", "")
default_service = google_compute_backend_bucket.hugo.self_link
host_rule {
hosts = ["*"]
path_matcher = "allpaths"
}
path_matcher {
name = "allpaths"
default_service = google_compute_backend_bucket.hugo.self_link
}
}
#HTTP
resource "google_compute_target_http_proxy" "hugo" {
name = "static-http-${replace("${var.domain_name}", ".", "")}"
url_map = google_compute_url_map.hugo.self_link
}
resource "google_compute_forwarding_rule" "httphugo" {
name = "http${replace("${var.domain_name}", ".", "")}"
load_balancing_scheme = "EXTERNAL"
target = google_compute_target_http_proxy.hugo.self_link
ip_address = google_compute_address.hugo.address
port_range = 80
region = var.region
network_tier = "STANDARD"
}
#HTTPS
resource "google_compute_target_https_proxy" "hugo" {
name = "static-https-${replace("${var.domain_name}", ".", "")}"
url_map = google_compute_url_map.hugo.self_link
ssl_certificates = [google_compute_managed_ssl_certificate.hugo.self_link]
}
resource "google_compute_forwarding_rule" "httpshugo" {
name = "https${replace("${var.domain_name}", ".", "")}"
load_balancing_scheme = "EXTERNAL"
target = google_compute_target_https_proxy.hugo.self_link
ip_address = google_compute_address.hugo.address
port_range = 443
region = var.region
network_tier = "STANDARD"
}
resource "google_compute_managed_ssl_certificate" "hugo" {
provider = google-beta
name = replace("${var.domain_name}", ".", "")
project = "spartan-studio-125417"
managed {
domains = ["${var.domain_name}."]
}
}
resource "google_compute_backend_bucket" "hugo_premium" {
name = "${replace("${var.domain_name}", ".", "")}premium"
bucket_name = google_storage_bucket.hugo.name
enable_cdn = false
}
resource "google_compute_global_address" "hugo_premium" {
name = "${replace("${var.domain_name}", ".", "")}premium"
}
resource "google_compute_url_map" "hugo_premium" {
name = "${replace("${var.domain_name}", ".", "")}premium"
default_service = google_compute_backend_bucket.hugo_premium.self_link
host_rule {
hosts = ["*"]
path_matcher = "allpaths"
}
path_matcher {
name = "allpaths"
default_service = google_compute_backend_bucket.hugo_premium.self_link
}
}
#HTTP
resource "google_compute_target_http_proxy" "hugo_premium" {
name = "static-http-${replace("${var.domain_name}", ".", "")}-premium"
url_map = google_compute_url_map.hugo_premium.self_link
}
resource "google_compute_global_forwarding_rule" "httphugopremium" {
name = "http${replace("${var.domain_name}", ".", "")}premium"
load_balancing_scheme = "EXTERNAL"
target = google_compute_target_http_proxy.hugo_premium.self_link
ip_address = google_compute_global_address.hugo_premium.address
port_range = 80
}
#HTTPS
resource "google_compute_target_https_proxy" "hugo_premium" {
name = "static-https-${replace("${var.domain_name}", ".", "")}-premium"
url_map = google_compute_url_map.hugo_premium.self_link
ssl_certificates = [google_compute_managed_ssl_certificate.hugo.self_link]
}
resource "google_compute_global_forwarding_rule" "httpshugopremium" {
name = "https${replace("${var.domain_name}", ".", "")}premium"
load_balancing_scheme = "EXTERNAL"
target = google_compute_target_https_proxy.hugo_premium.self_link
ip_address = google_compute_global_address.hugo_premium.address
port_range = 443
}
The Terraform code is here
I’m gonna experience with several method to observe, analyse, and test the performances of both standard and premium network tier.
Traceroute/MTR
From Spectrum Los Angeles (California - USA)
Click to enlarge
From Orange (France)
Click to enlarge
From OVH (France)
Click to enlarge
On the left hand side we have our STANDARD network tier and on the right hand side the PREMIUM.
As expected, the paquets targeting the STANDARD one are passing through many more hops (~25) compared to the PREMIUM (~9) where we can observe the paquet is going to the closest POP (then after we using the Google Network)
Do this number of hops have an incidence on the response time ? That’s what we’re gonna see next in the Curl section.
Curl
From Spectrum Los Angeles (California - USA)
time curl -s -o /dev/null 35.212.242.37 │ time curl -s -o /dev/null 35.190.3.150
real 0m0.182s │real 0m0.059s
user 0m0.013s │user 0m0.009s
sys 0m0.004s │sys 0m0.006s
From Orange (France)
time curl -s -o /dev/null 35.212.242.37 │ time curl -s -o /dev/null 35.190.3.150
real 0m0.618s │real 0m0.045s
user 0m0.025s │user 0m0.015s
sys 0m0.012s │sys 0m0.000s
From OVH (France)
time curl -s -o /dev/null 35.212.242.37 │ time curl -s -o /dev/null 35.190.3.150
real 0m0.527s │real 0m0.039s
user 0m0.012s │user 0m0.020s
sys 0m0.008s │sys 0m0.000s
Does it have an impact one the Page Speed Score and YSlow ? That’s what we’re gonna see next in the Curl section.
GTmetrix/webpage test
From United Kingdom
STANDARD
PREMIUM
The Page Speed Score and YSlow is very similar like also the Fully Loaded Time.
STANDARD
PREMIUM
The first Byte is arriving way faster on the PREMIUM than the STANDARD Load Balancer
Gatling
Let’s see if we can find a better results in terms of performance by injecting a bit more users from Digital Ocean (Amsterdam - Netherlands)
I created a 4vCPU, 8GB ram server with Digital Ocean located in the Amsterdam datacenter.
I use my previoulsy created gatling script and followed the instruction here to easily deploy a gatling injector.
The test was about injecting 15239 user in 10 minutes with a progressive ramp.
And here is the result:
STANDARD
STANDARD
STANDARD
PREMIUM
PREMIUM
PREMIUM
As we can see, the premium LoadBalancer has a better response time.
Also because of the less performant loadbalancer, my injector started to take delay and stackup requests that lead for the injector to saturation and breakdown at the end.
Conlusion
Google is using the power of their datacenter and pops all around the world to provide and propose
It is definitely worth it if you have a commercial website and you want to provide
But for my static blog, it’s definitely oversize and over kill.
The price is also quite expensive, it’s been more than a month I’m using the STANDARD Load Balancing and it’s already cost me ~$27
I understand that there is a lot of compute and engineering behind all of this and this is why it’s probably not appropriate for hosting a static personal blog.
I’m really thinking to migrate the blog to AWS and maybe do the same kind of test, stay tuned.