Why American Express Uses Golang?

American Express Uses Golang for Payments & Rewards

To start with why American Express uses Golang, let us understand what is American Express

American Express offers Global services that provide consumers and businesses with access to the products, insights, and enhance the lives and build a successful business. American Express has made things easier, simpler, and rewarding for the business, customers to make a purchase of the things they are in need of, and help merchants to sell their products or services by using expense, travel management solutions.

American Express started to use Golang in 2016

Initial days when they were looking for new programming language. The concern they had was the same as others around reliability and performance. The other concern was that the chosen programming language should be compatible with modern systems ( Infrastructure) and design patterns.

While Choosing Golang they started with language evaluation which they called as “ Language Showdown” during this evaluation same code was written in a various Programming language and then benchmarking was carried out. To choose one language from all of the available one is definitely one of the major things.

Based on some of the following criteria -:

  • A programming language which was used in high-performance platforms
  • A programming language which had good network programming support
  • A programming language which was a good fit for creating backend REST/gRPC APIs; and
  • A programming language that offered open-source libraries, and also a large community.

The four languages that were selected to finalized were C++, Java, Node.js, and Golang. Where else C++, Java, Node.js were already been used by American Express but Golang was yet to be tested and used.

After the programming showdown, Considering performance as the primary criteria results achieved were Golang was able to perform 140,000 requests per second. In the Programming showdown, languages included some of them had Garbage collection and some didn’t, Golang has garbage collection but the pause times in it are negligible.

In the production, we all have notices the pause times are in the range of approximately 250µs to 1ms, where else in Golang it is none.

Since then (2016) Golang has been improvised a lot in performance and other features.

American Express team says:-

From a performance perspective, we saw that Go lived up to its promise.

American Express Team Experience with Golang

Things they liked about Golang:-

  1. Simplicity — Golang is simple as well as straightforward language to learn. And the simplicity of the language is one of the important features of Golang. Developers with good understanding and basic experience with other programming languages can grasp about Golang quickly. Once the developer starts practicing this new language i.e Golang they get settled quickly however if you talk about expertise it does take time. Other than it good enough experience can help the developer to jump on the project in one month or so. Developer with prior experience in the C family languages gets familiar with Golang in lesser time.
  2. Best Practices — Golang helps and motivates the developer for programming using the best practices. One of its examples is in unused imports and variables. Where else the other language will allow you to import or define variable even if you are never using it. But in Golang if the same case happens, build tools will fail to build. Such programming practices keep programs performant by removing unwanted and unnecessary objects, dependencies. Best practices achieved in Golang through some of the following:- Error handling — This feature in Golang is one of the ways that motivate developers for best practices. At the same time, Error handling in Golang is controversial. Golang helps you with multiple return values on the functions. Golang offers tools to catch unhandled errors and these tools can also be integrated with ease into the CI pipeline. Godocs — In every programming language commenting code is considered as the best practice and Golang motivates commenting of code through using code comments which is the source for the package documentation. Any Popular open source Golang package is expected to have quality Golang Docs.
  3. Concurrency — Languages other than Golang, the standard way to handle the concurrent request is by using threads. The application creates OS threads and segregates tasks across the threads. Threads created are resource-intensive and will occupy at least 1MB if space per thread in the stack. Application is responsible to manage and control the number of threads it creates. Which is usually achieved by creating a thread pool and then managing it. Where else in Golang, Golang has Goroutines. The tasks are distributed to Goroutines, Goroutines are cheaper than OS threads and use or require comparatively lower stack space per Goroutine which is around 2Kb. Goroutines are managed by Go runtime, Go runtime is responsible to manage the allocation. Using Goroutines concurrency is achieved in an easier and straightforward way. Golang’s concurrency also provides one more core aspect that is channels. Channels act like internal queues.
  4. Great Tools — Golang has an assortment of tooling which makes the development in Golang easier. It has powerful built-in testing, benchmarking framework, gofmt commands for auto-formatting of code which helps in maintaining consistency of code. Profiling tool i.e PProf which helps you dig in the detailed performance hot spots. The build has helped American Express in significant productivity gains, Comparative to other languages, Golang build time was half or better than them. Which ultimately benefited in scales quickly because engineers run many builds per day.

The build was one of the specific area where we have seen significant productivity gains.

About Convincing Leadership of American Express

After the result of the Language Showdown result, the American Express team chose to go with Golang as the recommended Programming language. Before starting with Golang American Express needed to convince their Leadership, which they achieved by some of the following ways:-

  1. Through internal position paper: Which consisted in-detailed explanation of Golang’s syntax, benefits of Golang, and its use cases. This method helped with where Golang can be used and where it cannot be useful.
  2. Pilot applications: These were the real-world services of the production, they used Golang in such services and were able to show how memory overhead was reduced
  3. POC’s
  4. Long conversations

And finally, they were able to convince the leadership

What makes Go different from other programming languages is cognitive load. You can do more with less code, which makes it easier to reason about and understand the code that you do end up writing.

The majority of Go code ends up looking quite similar, so, even if you’re working with a completely new codebase, you can get up and running pretty quickly.

— Glen Balliet, Engineering Director of loyalty platforms at American Express

Read more about the original post here, American Express has also published Golang Case study to help other enterprises determine if Golang is right for them

You can also read more articles about Golang here-

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Reemi Shirsath

Reemi Shirsath

110 Followers

𝘾𝙊𝙊 @ 𝙂𝙤𝙡𝙖𝙣𝙜 𝙎𝙥𝙚𝙘𝙞𝙖𝙡𝙞𝙨𝙚𝙙 𝘿𝙚𝙫𝙚𝙡𝙤𝙥𝙢𝙚𝙣𝙩 𝘾𝙤𝙢𝙥𝙖𝙣𝙮- Scalent.io