
Go - The well-crafted Programming Language that Delivers more Bang for your Web Hosting Buck.


Perhaps, one of the most appealing aspects of Go is the emphasis on efficiency built into the design of the language itself. Due to this efficiency, many firms have dramatically reduced production application server instances, cutting web hosting costs significantly. Iron.io reportedly went from 30 production server instances running Ruby on Rails to just 2 production server instances running Go!
In this article, we will examine the key aspects of Go that provide such a competitive, economic advantage in web hosting over other comparable server side technologies. We will also consider several advantages that Go offers for increased developer productivity.
Better Resource Utilization
Go applications are statically compiled, native binaries, that have a modest memory footprint. It is not necessary to have Go installed on the server to run Go applications. Running Go applications as native binaries, allows well-written Go code to attain similar, high-performance characteristics with their C and C++ counterparts. Java, NodeJS, PHP, Python, and Ruby require either an interpreter or a virtual machine for Just-In-Time (JIT) compilation of bytecode. In addition to allocating CPU and memory resources for applications running in these languages, one must also pay the additional performance penalty for the interpreter/virtual machine which will consume CPU resources and may easily consume several hundred megabytes of memory at a given time. Finally, with regards to parallel computations, Go automatically distributes work across the logical cores of a multi-core system.
Ultimately the value of a programming language lies not only in efficiency from the perspective of a machine but also in efficiency from the perspective of a developer
Concurrency Is Built Into The Language
Go comes with two powerful built-in concurrency constructs: goroutines and channels. Goroutines are lightweight threads that are managed by the Go runtime. Channels are the conduits for communication between goroutines. Other languages, such as Java, require the explicit use of OS threads and follow a pattern of locking/unlocking those portions of code that are run by multiple threads. At times, extra work must be done, such as allocating thread pools and dividing the workload into a certain number of threads to avoid the overhead of creating new OS threads. This type of extra work is not needed in Go, since it is cheaper to spawn a goroutine than an OS thread and the Go runtime efficiently multiplexes goroutines onto OS threads.
Developer Efficiency Is Important Too!
Ultimately the value of a programming language lies not only in efficiency from the perspective of a machine, but also in efficiency from the perspective of a developer. Go includes many features that allow developers to be highly productive.
Go has a simple and terse syntax, much like C. Adopters coming from a Java background, will immediately notice a sharp difference between the simplicity of writing Go code compared to the highly verbose nature of writing Java code. Writing fewer lines of Go code to accomplish a given task, directly implies that there are fewer lines of code that require human maintenance in a project codebase.
Go is a statically typed language unlike popular scripting languages such as JavaScript, Python, Ruby, and PHP. As a statically typed language, Go comes with the advantage that many problems can be discovered at compile time. The language also comes with type inference capabilities, giving Go the feel of a dynamic programming language along with the added benefit of type safety.
The tooling around Go is truly remarkable. For starters, the Go compiler is a speed demon! Having worked on many Java projects that take several minutes to compile, it is highly satisfying to see Go projects compile within a few seconds. The credit for this goes to Go’s model for software construction which relies on an implicit build system that automates dependency analysis. This means that developers do not need to manually maintain project build files as they would be required to do so in Java and JavaScript (e.g., Grunt and Gulp) projects.
Finally, Go is a highly-opinionated language that comes with its own set of idioms and best practices, many of which, are derived directly from the developer productivity success/failure scenarios found from the programming languages that preceded it. For this reason, it can be understood, that good programming language with good programming principles exert a strong influence on the creation of highly effective, well-engineered, back-end systems.