When Google gets frustrated with the complexities and slow speed of Internet technology, they do what Google does best — they solve for it. They set out to create a new language that was fast, worked on large server systems, scaled well, and could run concurrency smoothly. The result is Go. And, when our customers speak, AppDynamics does what it does best — we listen!
AppDynamics announces its official support for Go
We’re excited to officially announce our support for Go! In our Spring ‘17 release, application teams may take advantage of the AppDynamics platform now available for their Go apps. Monitor your Go applications in real time, correlate transactions across your distributed environment, and diagnose performance bottlenecks while running in a live production or development environment.
What Is Go?
Go was created in 2007 by Ken Thompson, Rob Pike, and Robert Griesemer, along with a number of contributors. One of the most prominent is Thompson, who also wrote the B programming language and was instrumental in the design and introduction of the Unix operating system.
Google formally introduced Go in November of 2009 and began using it in some of their production systems. Other companies soon began deploying it as well. There is an open-source version called “gc” that works on a number of platforms including UNIX, Windows, BSD, and Linux. As of the beginning of 2015, it also works on smartphones and mobile devices. A second version, “gccgo,” is a frontend component for the GNU Compiler Collection (GCC).
The language began as an experiment among several Google programmers. They wanted to create a new language that took care of some of the problems of other languages while keeping their positive attributes. They wanted it to be statically typed and highly scalable. It also had to be legible and productive, foregoing many of the keywords and repetition of other languages. They also wanted to handle networking and multiprocessing quickly and easily. The engineers who worked on the project had a deep-seated disdain for the complexity of C++. Go shares some of the characteristics of C, but is built to be simpler, safer, and more concise.
Go uses unique approaches to handle the problems common in other languages. It has built-in concurrency, channels, and lightweight processes called goroutines. The toolchain creates statically linked binaries with no dependencies from external sources. It uses an interface instead of virtual inheritance and type embedding rather than non-virtual inheritance. Go is statically typed, open-source, and compiled. Published under BSD licensing, it also has (among other features):
- Memory safety components
- Garbage collection
- Concurrent programming
- Structural typing
Built for Concurrency
Go is made for concurrency. While older languages were designed with only a single processor in mind, Go runs efficiently on today’s multicore processors with parallel processing.
Concurrent does not necessarily mean two processes are running at the same time (i.e., parallel processing). Concurrency refers to two tasks being able to begin, run, and end in overlapping periods of time (e.g., they may not actually ever run at the same time). In contrast, parallelism refers to two tasks operating at the same time, as you find in a multicore machine. An example of concurrency is when a single-core computer handles multitasking, which is what makes Go ideal for high-load systems such as an API handling massive amounts of requests from mobile devices or browser calls.
Go is verbose. You have to use a lot of code to complete commands. It also has a lot of libraries, to name a few:
- regular expressions
- file CRUD operations
On the flip side, you have to import these libraries, because it won’t compile if you don’t. This was made to keep Go as lean as possible. It’s fast, and built-in concurrency lets you run a lot of simultaneous processes.
Companies Using Go
Thousands of companies around the world currently use Go, including:
- Google (of course)
- BBC Worldwide
Smaller companies are also on board, including:
Here are some real world examples:
After using Python in the early years of its operation, Dropbox realized their success and growing customer base required a language that could scale better and handle bigger loads. In 2013, they began to move important backend operations from Python to Go. The goal was to improve their concurrency and execute code faster, successfully deploying 200,000 lines of Go computer code.
At the time, they were somewhat hindered by Go’s lack of deep libraries, a characteristic of its youth and newness. The Dropbox developers took on the tasks themselves and began to create libraries for Memcache, connection management, and other purposes. They contributed to the Go open-source effort by making the libraries available to other programmers and companies interested in building production systems that can scale quickly and effectively.
Around the same time Dropbox changed over to Go, cloud-based email service SendGrid decided to do the same. In the first years of operation, their backend consisted mainly of Perl/AnyEvent, later changing to Python/Twisted. They considered the Gevent/Python framework but realized it wouldn’t do what they needed. They narrowed it down between Go, Java, and Scala.
Because they handle more than 500 million email messages every day, one of their biggest challenges is concurrency. Go’s ability to handle concurrent asynchronous programming was a major factor in their decision to use it. At the same time, it was a language their developers were very interested in using, unlike others that they felt like they had to fight every day. In fact, several developers were so excited about it that they began to teach it to themselves and experiment on their own. This turned out to be a decisive factor because the company realized their team was already using it in their off hours and would be enthusiastic about using the language every day.
Numerotron is a small firm that developed a program called StatHat to allow developers and engineers to track events and statistics right in their code. StatHat can be used in twelve different computer languages including Go and HTML, and it can be easily deployed by a wide variety of professionals including backend engineers and designers.
Patrick Crosby, founder of Numerotron, said they chose Go for StatHat because it met many of their criteria, including great performance, many connections on one machine, fast HTML templating, quick startup and recompilation, extensive libraries, and open-source.
Go Vs. Other Languages
Part of the appeal of Python is that it is so versatile (e.g., scripting vs. object-oriented and functional programming). It can run on any platform that includes a Python interpreter. It is used worldwide for both large and small application development.
It is very verbose, and it’s made to solve specific problems without constraints. It lets you build programs rapidly and then modify those programs to create powerful solutions. It’s simple to learn but takes time to fully understand. One of Go’s major strengths is its ability to handle concurrency efficiently using channels and goroutines.
In many ways, Go is a new version of C. The Go creators attempted to clean up the problem areas of C and take out functionalities that were creating bottlenecks. Go is simpler than C, although the primitives are more detailed than those found in Java and C++.
Go is a young language, so the contributors were able to incorporate features that make it extremely effective in meeting the demands of modern web-scale traffic. While Java continues to be one of the major languages used for application development, older, similar languages have some limitations in scale.
The Future Is Bright
Go is an effective solution for projects that need scale to handle massive amounts of traffic. As the amount of data continues to expand, Go is a modern solution to building applications that can handle the demand. Expect to see Go adopted more and more as the world moves forward to meet the demands of modern web-scale traffic.