How to make an API/Platform faster, easier to manage and cheaper to run

The news that Dropbox has migrated its’ performance-critical backends from Python to Google Go (confusingly also known as golang) has surprised some people..but probably not people like me who have already successfully migrated a backend platform to golang.

What is Google Go/golang?

Go/golang is an open source programming language created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. In computer language terms that very much makes it the new kid on the block (Java has been around since 1995 and PHP since 1994) but Robert, Rob and Ken have done a great job of bringing together all the best ideas from all the existing languages. As an open source project it is essentially free to use and Google say more then half of check-ins on the project are now done outside Google.

At Hailo we migrated our back end from a mixture of PHP and Java to golang and in the process made our backend faster, simpler and cheaper to run.

We didn’t have any golang developers at Hailo when we decided to move to it so our existing PHP and Java developers had to learn it “on the job”. With a few exceptions they took to it like “ducks to water”.

Golang is easier to write and manage than Java, it runs faster than almost everything except C/C++ and because it scales across the multiple cores/CPUs in a server “out of the box” you can save money by using less servers.

Faster, easier and cheaper..really?

Faster

Go is a compiled language that compiles the source code programmers write down to the binary language servers can execute without further translation.

This is different to the interpreted languages like PHP/Python/Ruby that need to run on top of software virtual machines. This makes Go significantly quicker in a straight line than scripting languages. (It’s not even that much of a problem that you need to compile your code before you run it. The run command compiles and runs your go code so quickly that it’s like working with a scripting language).

Go is so blisteringly fast that it is now actually being used to write a lot of the components underpinning the leading edge digital architectures. Docker (the rapidly growing virtualisation technology) is written in Go as is NSQ (the rock solid messaging platform) as is Bitly and so on.

Easier

Go is object based (rather than object orientated like Java) and has none of the fiddly memory management and pointer things you need to keep on top of in C++.  Because it compiles down to a binary executing it is as simple as deploying a file to a server and running it. There are no libraries, frameworks or interpreters to worry about.

Some people think the Go compiler is a little too fussy (it will complain if you include a library and don’t use it for instance) but in combination with Go being a strongly typed language (I won’t open that can of worms here) the upshot is that more errors are usually found at compile time rather than found at run time – and we’d much rather we saw any errors than our customers did.

Cheaper

Go’s killer feature is its concurrency model.

Out of the box it will automatically create code that utilises multiple cores/CPUs by creating parallel executing threads.

With interpreted languages even if they are technically multi-threaded only one thread can ever execute at one time (because of the Global Interpreter Lock).

This is how companies like Hailo and Dropbox have achieved dramatic scalability improvements by moving to Go.

This is a graph of Hailo jobs (blue line) and Amazon Web Services cost per job (brown line) that Boyan Dimitrov of Hailo presented at an AWS conference.

Faster, easier and cheaper? What is there not to like?

There is no such thing as a “good” or “bad” computer language, they all have strengths and weaknesses, and you need to work back from the problem you’re trying to solve before deciding which language is optimum for your particular circumstances.

Go/golang is state of the art for use cases like backend APIs and micro services frameworks where you want low response times and low hosting bills, but it isn’t really designed for the user interface layer…JavaScript is eating that particular world.

Golang’s relative newness also means that there aren’t as many libraries (chunks of code you can include and use) as existing for other languages. Good open source citizens like Dropbox are writing and open sourcing any missing ones as we speak.

There aren’t as many golang programmers on the market yet as for other languages but we certainly found at Hailo that the opportunity to use golang attracted as many talented programmers as we needed and nearly all of our PHP and Java developers found it easy to learn and get productive on.

Having two names (Go and golang) is a bit confusing and the Gopher logo (above) is a little odd..but I’m nitpicking now.

In my experience a back end platform written in Go will probably be quicker, easier and cheaper than all the current alternatives but a lot really will depend on your business needs.

Not every business wants or needs minimised response times and maximised scalability and the cost of migrating an existing API/Platform is far from free of course.

Rorie Devine

Rorie is the only person to have featured on the cover of CIO Magazine twice, has been awarded "IT Leader Of The Year" by Computing Magazine and is featured in the book "How To Build a Billion Dollar App"​ saying that the change he brought when coming in as an Interim was "truly amazing"​ and "we started to feel we were firing on all cylinders"​. Rorie was recently described as "one of the best business technologists in the country" but doesn't take himself too seriously, understands that leadership is about change, and relishes the opportunity to increase revenue, evolve business models, remove structural constraints and/or improve efficiency. Very much with a hands-on approach, Rorie derives accomplishment from the achievement of significantly improved business results. Specialties: Growth hacking and bringing agility, focus, clarity, simplicity, reliability and urgency. Delivering high revenue growth, removing business constraints, and improving efficiency. Helping conceive and deliver ambitious change agendas.

Have Your Say: