Configuring load balancing and location headers on Google Cloud

Share

I have a need at the moment to know where my users are in the world. This helps me to identify what compute resources to serve their request with in order to reduce the latency they experience. So how do you do that thing with Google Cloud?

The first step is to setup a series of test backends to send traffic to. I built three regions: Sydney; London; and Los Angeles. It turns out in hindsight that wasn’t actually nessesary though — this would work with a single backend just as well. For my backends I chose a minimal Ubuntu install, running this simple backend HTTP service.

I had some initial trouble finding a single page which walked through the setup of the Google Cloud load balancer to do what I wanted, which is the main reason for writing this post. The steps are:

Create your test instances and configure the backend on them. I ended up with a setup like this:

A list of google cloud VMs

Next setup instance groups to contain these instances. I chose unmanaged instance groups (that is, I don’t want autoscaling). You need to create one per region.

A list of google cloud instance groups

But wait! There’s one more layer of abstraction. We need a backend service. The configuration for these is cunningly hidden on the load balancing page, on a separate tab. Create a service which contains our three instance groups:

A sample backend service

I’ve also added a health check to my service, which just requests “/healthz” from each instance and expects a response of “OK” for healthy backends.

The backend service is also where we configure our extra headers. Click on the “advanced configurations” link, and more options appear:

Additional backend service options

Here I setup the extra HTTP headers the load balancer should insert: X-Region; X-City; and X-Lat-Lon.

And finally we can configure the load balancer. I selected a “HTTP(S) load balancer”, as I only care about incoming HTTP and HTTPS traffic. Obviously you set the load balancer to route traffic from the Internet to your VMs, and you wire the backend of the load balancer to your service. Select your backend service for the backend.

Now we can test! If I go to my load balancer in a web browser, I now get a result like this:

The top part of the page is just the HTTP headers from the request. You can see that we’re now getting helpful location headers. Mission accomplished!

Share

MythTV talk at Google

Share

I’m giving a MythTV talk at Google in the next week (although I can’t find it on the events calendar at the moment, I’ll update this post when I do) so I’ve been playing with MythTV 0.21 a little more than I have in the past. Its pretty cool.

I’m still writing the talk, so I don’t know 100% what it will cover, but I’m thinking it would be good to include some of the stuff from 0.21 as a teaser. Storage groups, the flash player in MythWeb, and the tweaks to the theme system seem like good things to include. Does anyone have other things they think are really cool in 0.21?

Oh, and I’ll have to cover guide data for the US, so it might be time to catch up with my MythTV email backlog once again.

Hopefully in you live near Silicon Valley you can come along to the talk and we can chat afterwards.

Update: I found a Google blog post with the details. To quote the most important information:

Like all sessions of the Open Source Developers @ Google Speaker Series, Michael’s presentation will be open to the public. Doors open at 6:30 PM at our Mountain View campus; guests should plan to sign in at Building 43 reception upon arrival. Refreshments will be served and all are welcome and encouraged to attend. Michael’s presentation will also be taped and published along with all of the public Google Tech Talks.

Share

A MythTV Jabber bot

Share

While I love my wife and kids to distraction, the distraction bit is real. Then again, I’m sure they have a counter argument that I tend to end up deep in thought, and which point you could probably push me off my chair and I wouldn’t notice. Anyway, that’s mostly beside the point. What is relevant is for the first time in nearly a year (since 18 November 2005 to be exact, but who is counting?) I’m alone. All alone.

So, apart from watching the West Wing (which I haven’t seen before, and is fantastic), sleeping in, and going to a party tonight, I am coding.

What I’m writing is a follow on from my night hacking the other day, which was getting PyXMPP working with Google Talk. What I want is a bot which will take IM messages, and execute them using the MythTV front end. Oh, and it will display text using the on screen display if you ask nicely.

So, does anyone have any thoughts on if that sort of thing is useful to them? I think it sounds useful to me, but perhaps I’m odd.

Back to hacking.

Share

Slashdot, Google and Slack

Share

Rodney Gedda’s writeup of my talk on Slack (which by the way is in no way a comment on Slackware, or derived from Slackware) got slashdotted today. I am assured by Alan that the download link stayed up just fine, despite benley’s best efforts. To be honest, I wasn’t expecting this level of attention, although the tool is very cool.

Other press coverage (that I am aware of) for my AUUG talks includes:

Obviously many of these articles recycle content, and the links above still include the Google News redirects, because it’s easier than editting them out by hand.

(I have been slashdotted before, for TwinkleTux, and another time with the review for the ImageMagick book. Then there was the time that one of my articles about ImageMagick got slashdotted (direct link), but for some reason the sequel didn’t.)

Share

Creepy

Share

mary had a little Lamb Its fleece was white as snow; And as red as blood, and as black as the night, with the Corps Program, is for students. who have a disability or medical- condition is required to be submitted to the Storting. in the spring of the year. in the Shadows of Motown

From Google Talk.

Share