Two-year summary of the Go language used in production environments

Source: Internet
Author: User
Tags benchmark install go
This is a creation in Article, where the information may have evolved or changed. English Original: Go after 2 years in Production

After two years of using the go language in the Iron.io production environment, I want to share our experience and feelings. We were one of the first companies to use go in a production environment, and for a long time we didn't know what to expect, but so far, it was great.

In a previous article I talked about switching from Ruby to go, but this time it will be more detailed, and we like the language and what we learned along the course. The introduction does not have a specific order, as follows:

  • Performance (performance)
  • Memory consumption
  • Concurrency (Concurrency)
  • Reliability (Reliability)
  • Deployment (Deployment)
  • Talent (Talent)

Garfielt
Translated over 2 years ago

1 Person top

top translation of good Oh!

performance

When we first decided what language to use we did some research for our application environment, Message Queuing has created some simulations. I used go to write a copy of my favorite BEANSTALKD implementation, using the BEANSTALKD protocol so that I can use the existing client tests. Go is a good performance, almost the same as the official C language (and surprisingly easy to write).

You can find a comparison of go and other language benchmarks on the computer language benchmark game website. The following figure is the result of comparison with Java, which is probably the language we should use when the go language does not exist:



More

garfielt< br> translated 2 years ago

1 people top

top   Good translation!

This benchmark shows that go is faster in some cases, but In other cases, it is slower than Java. However, for a few years old language is not too bad, there is no doubt I think give it some time it will certainly catch up. You can also see that the memory footprint is very good.

Just for fun, there's a difference between C and go and Ruby, which is even more insane in terms of performance and memory usage.



More  

For two years, go has never been our bottleneck, and the bottleneck has always been on the database.

Garfielt
Translated 2 years ago

0 Human top

top   good translation!

memory consumption

Go does not need to load a virtual machine or interpreter, so it starts fast and small. Ironmq starts with ~ 6444 KB of memory, which also includes loading configurations, establishing connections, and so on. When it runs for a while, memory usage increases because it increases the cache, and so on. Now, our production server runtime memory occupies ~400 MB (which I think is irrelevant, depending on your application).

For two years, we have never experienced a memory leak or other memory-related issues.

concurrency (Concurrency)

Concurrency is an important part of go, but a high-level structure makes it easy to use. I've been using Java for many years and it's comfortable to use the java.util.concurrency package, which is a good concurrency tool, but it's not as easy to use as go on the bottom-up implementation. Go uses goroutines for concurrent operations, and uses channels to communicate between them. Goroutines very interesting:

Garfielt
Translated 2 years ago

0 people top

top   Good translation!

"Goroutines is the part that makes concurrency easy to use. This is an idea that has been considered for some time and is a function-coroutine that is executed independently on a series of threads. When a coroutine is blocked, the call blocking system calls, the running environment automatically switches to other coroutine--to the same system and can run threads, so that they do not clog. The programmer doesn't have to touch these operations, that's all. As a result, what we call goroutines, it consumes very low: unless it spends a lot of time on system calls that consume time, it consumes less memory than the base stack, only a few kilobytes. To make the stack smaller, go runs in a segmented stack. A newly created goroutine allocates only a few kilobytes of memory, which in most cases is sufficient. When the memory is insufficient, the runtime automatically assigns (releases) the expanded segment stack. The above is the estimate of the three underlying indicators for each function call. It is possible to create a hundreds of goroutine in the same address space. If Goroutine is thread-based, system resources are exhausted in a smaller number. "Reference

One thing to do here is to limit concurrency to ensure that our databases or other services are not overloaded in the event of a burst. We use a simple signal implementation of the Go channel.

Garfielt
Translated 2 years ago

0 Human Top

top   Good translation!

reliable The reliability of the

language is hard to quantify, but we find our go application very powerful. We have encountered some failures/crashes but because of some external problems (read: Database or some poorly designed library). Generally speaking, there are a lot of high quality go open source libraries now. We have not found memory leaks and significant core library errors.

I even found that our code was high quality because it was written in go. I don't know why, but I feel warm and supple when I write something with go. Perhaps it is a very strict compiler and even forces us to delete useless references and variables. Perhaps it is a language that accomplishes more with a small amount of code. In the future I will find something similar and write them out.

Garfielt
Translated 2 years ago

0 Human Top

top   Good translation!

deployment The

Go compiles all the source code into a single, statically linked file, so the deployment is simple, as long as you upload the file and then start it, without any dependencies. There is no run-time dependency. You do not need to install go on the server. and compiled binary is very small, Ironmq binary file approximately 6MB

rollback

If you run a problem after you deploy and you need to roll back to the previous program, just close the wrong program, Rerun the previous program. After the program is compiled into a single binary file, you do not need to worry about dependencies after the upgrade.

Lidashuang
Translated 2 years ago

1 Human top

top   Good translation!

Talent

When we took a big risk choosing go, Go was not known by many people, and it was seldom heard. We were the first company to send a go job on a Go language enthusiast mailing list, and we were surprised by the quality of the applicants ' application. We received a job application in China, there are some leading technology companies with extraordinary experience in the developer, there are doctors working on some core projects. Most do not use go for full-time programming, but work very go and passing on their experience and knowledge. I'm not sure what we're trying to build is important, but they want to work with go.

Our first go-hired person is a go core developer, Evan Shaw, who is now with us.

Garfielt
Translated over 2 years ago

0 Person Top

top translation of good Oh!

Summary

After two years of using go to work I can confidently say that we have made the right choice. If we start Iron.io now, go is a choice that you don't have to think about. Many other companies are now using go, including Heroku, Google and people I've said go to have similar opinions. Rob Pike, a go creator, says:

" we realized that the software we built on Google used the language we already have and that it wasn't exactly as envisioned," Pike said in 2011. "Robert Griesemer, Ken Thompson and I decided to create a language to write the kind of program Google needs. "
Derek Collison, founder of Apcera, recently said in Wired's article:
" does the new technology's management and infrastructure tiers provide this cloud delivery model?" "He said so on the wired." "Within two years, most of it will be written in go. "

Is go the next generation of languages we've been waiting for? This one is too early to say, but it is undoubtedly a good starting point.

Garfielt
Translated over 2 years ago

0 Person Top

top translation of good Oh!

All translations in this article are for learning and communication purposes only, please be sure to indicate the translator, source, and link to this article.
Our translation work in accordance with the CC agreement, if our work has violated your rights and interests, please contact us promptly
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.