Salesforce: Why we ditched Python for Google's Go language in Einstein Analytics

Salesforce explains why Google's Go programming language is a better fit than Python and C for Einstein Analytics.
Written by Liam Tung, Contributing Writer

Salesforce recently spent $15.7bn on analytics company Tableau to beef up its own Einstein Analytics platform. Clearly Salesforce sees analytics as critical for its future. 

But before the company launched Einstein Analytics in 2017, it overhauled the backend and rebuilt it almost entirely on Google's popular Go, or 'Golang', programming language.

SEE: Six in-demand programming languages: Getting started (free PDF)

According to Salesforce principal architect Guillaume Le Stum, before Salesforce launched Einstein Analytics, the query engine and dataset creation tools that eventually became Einstein Analytics were written in C "for performance" and a Python wrapper that provided functionality like parsing queries, and a REST API server. 

"In essence, the product was built to have the best of both worlds," explains Le Stum in a post on Stack Overflow

"Python is great for quickly writing higher-level applications but doesn't always deliver the high performance needed at an enterprise level. C creates highly performant executables, but adding features takes a lot more time."

Python is of course hugely popular with developers, including engineers at Netflix who use Python across every part of its vast streaming infrastructure.  

But before launch, Le Stum says the guts of Einstein Analytics started to show performance slowdowns because any new feature that wasn't part of the core query engine got loaded onto the Python wrapper. 

So, while Salesforce could quickly develop and deploy features with Python, eventually the approach made it sluggish. 

"Python doesn't do multi-threading very well, so the more the wrapper was being asked to do, the worse it performed," explains Le Stum. 

Go, on the other hand, is built for huge applications suitable for Google's production systems, so Salesforce decided to shift Einstein Analytics from a hybrid C-Python application to a completely Go application.   

Le Stum also identifies two more downsides of staying with Python, despite some of its advantages. 

"First, Python uses loose typing, which was great for a small team rapidly developing new ideas and putting them into production –but less great for an enterprise-scale application that some customers were paying millions of dollars for," he writes.

"Second, we foresaw a vast dependency nightmare on the horizon, as deploying the right Python libraries, versions, and files would become a chore. So in 2014, we decided to port the Python wrapper to Go." 

SEE: Microsoft: We want you to learn Python programming language for free

Le Stum says the strength of Go include its built-in tooling, quick compile times and deploys, and easy troubleshooting, as well as the way it makes code easy to understand. 

"In Python, you could write super-elegant list comprehensions and beautiful code that's almost mathematical. But if you didn't write the code, then that elegance can come at the expense of readability," he explains, noting that in enterprise software, engineers spend more time reading code than writing it. 

The group still had questions over Go's performance compared with C for the query engine. However, a proof of concept written in Go enabled them to proceed, and the Go version of Einstein Analytics reached general availability in 2018. 

One of the big advantages is that Go's cross-platform features make porting code easy. 

"If we ever need any of this code in a mobile app, we can cross-compile it to iOS or Android and it will just work," Le Stum notes. 

The sole part of Einstein Analytics that isn't built with Go is the cluster manager, which is written in Java. 

Update: Salesforce has asked ZDNet to point out an inaccuracy in the company's original Stack Overflow piece. While Salesforce did indeed port the Einstein Analytics query engine from a C-Python hybrid to Go, Einstein Analytics is built on other languages besides Go and Java, although Salesforce declined to say what these other languages are.

More on programming languages 

Editorial standards