How a Company Reduced its number of Server from 30 to 2 Using Golang
This is the success story of the company Iron.io which is a consulting company. Who were able to reduce their server from 30 to 2 servers by using Golang.
They built the first version of IronWorker using Ruby and Amazon web services. It is “workers as a service”. Which they used internally first and later they made it Publicly available. The idea behind it was, they wanted to build something they could use for all of their clients without having to manage a bunch of infrastructures, and for each of them to process this data and it gave birth to IronWorker.
They had clients who were developing hardware devices, these devices used to send the data 24/7 and once the client sends the data people from Iron.io needed to collect it, then process it and store it.
About CPU Utilization
Their initial CPU utilization was around 50 to 60%, later the requirement increased a bit so there was the need of adding some more servers. It didn’t seem to be a big thing for them as they were not paying much. But the new challenge that came in the picture was about a big traffic spike that caused the domino effect and that would take the entire cluster down. At the threshold above 50%, their Rails servers showed spike up to 100% CPU usage and used to get unresponsive. Which caused load balance to think that the server failed and would apply the load on the remaining servers. And since the rest servers were handling the load of the lost server along with spike handling the other second server would also go down. And again the load balance would take the load and pass it on to the rest working server which ultimately caused the number of servers to go down.
The only way out they triggered was to have extra capacity in order to reduce the server utilization much lower than what it initially was. But that would directly increase the cost.
They thought it is possible to resolve this problem by either rewriting the API
So first they started with rewriting the API-
They felt this was the simple and easy decision to rewrite the code, they came to the conclusion that Ruby on Rails API is not going scale well and as they were from Java development background with some experience in developing and handling tons of load with fewer resource requirement as compared to Ruby on Rails. They came to a realization that they can do more better and then came down to the decision of choosing the language
Choosing the Language-
They were looking for some new ideas, as they were more into productive results. They looked for other scripting languages which were comparatively better in performance than Ruby. language like Python and also explored more in derivatives of Java-like Scala and also other languages like Erlang and Golang. Were Golang caught their attention and seemed to be promising to also fulfill their expectation. Concurrency is one of the impressive fundamental features that Golang have and which was a huge thing, and the other feature like fast compilation, fun to code, simple to understand and standard core library had almost everything which was required to build an API. But not just the these they also did the experiment like some prototyping and performance testing and taking into consideration it has Google backing they selected the Golang.
Their Start with Golang-
When they decided to go with Golang it was a bit risky decision as per them, as there was not a big community or much of open source project. And not many users of Golang were present at that time. There were many issues and problems that were hampering their brain like availability of top talent in the Golang, but later they realize they are many people who were adapting Golang.
Their Experience with Golang -
After using Golang they said, “We Reduced our server count to two and we really only had two for redundancy”. They said the server was like light weighted as if nothing was running on the servers. CPU utilization was less than 5% and the process initiated just with few hundred KB’s of memory. Even the JVM memory usage was optimum and they never face the issue of server getting down again and again
They also said
In retrospect, it was a great decision to choose Go as it’s allowed us to build great products, to grow and scale, and attract grade A talent. And I believe it will continue to help us grow for the foreseeable future.
And this way they achieved to reduce their server to 2 servers by using Golang, you can read more about Iron.io here
The original article was from 2013 since then Golang has improved a lot in many of the factors like performance, community support, runtime, etc.
You can also read more articles about Golang here-
Things You Need to Know About Golang For Web Development
Here Is Why Golang Is One Of The Preferred Technology For Your Project