Old boy EducationGo language training is the first go language training organization, the teacher is a senior Xiaomi architecture architect, has many years go development experience. Small compilation Now the Go language advantages organized as follows, I hope to help you
1. Simple Deployment
Go compilation generates a static executable file with no external dependencies other than glibc. This makes deployment incredibly convenient: only a basic system and the necessary management and monitoring tools are needed on the target machine, so it is not necessary to worry about the dependencies of the various packages and libraries required by the application, which greatly reduces the burden of maintenance. This is a huge difference from Python. For historical reasons, Python's deployment tools are quite chaotic, such as Setuptools, Distutils, Pip, buildout, and compatibility issues. The official PyPI source is often problematic and requires a private image, while maintaining the image takes a lot of time and effort.
2. Concurrency is good
Goroutine and channel make it easy to write high-concurrency server-side software, and in many cases there is no need to consider locking mechanisms and the various problems that arise. A single Go application can also effectively utilize multiple CPU cores and perform well in parallel. This is also the Tianrang of Python. Multi-threaded and multi-process server-side programs are not easy to write, and because of the global lock GIL, multi-threaded Python program can not effectively use multi-core, can only be deployed in a multi-process way; If you use the multiprocessing in the standard library The package will also cause a lot of challenges in monitoring and management we use the Supervisor management process, the fork support is not good. When you deploy a python application, you typically deploy an application for each CPU core, which can cause a lot of wasted resources, such as assuming that a Python app takes up 100MB of memory while the server has 32 CPU cores, leaving a kernel to the system and running 31 copies of the application.
You will waste 3GB of memory resources.
3. Good language design
from the academic point of view the go language is very mediocre, does not support many advanced language features, but from the engineering point of view, go design is very good: The specification is simple enough and flexible, the other language based programmers can quickly get started. More importantly, Go comes with a complete tool chain, which greatly improves the consistency of team collaboration. For example, GOFMT Auto-typesetting Go code, to a large extent, to eliminate the different people write code layout style inconsistent. Configure the editor to save
files automatically run gofmt, so that when writing code can be placed at random position, when the archive automatically become the correct layout of the code. There are also very useful tools such as Gofix, Govet and so on.
4. Good execution Performance
It's not as good as C and Java, but it's usually a bit higher than the native Python app, and it's suitable for writing some bottleneck business. The memory footprint is also very provincial.
This article is copyright to the old boys education all, welcome reprint, reproduced Please indicate the source of the author. Thank you!
Old boy Education
Starter: http://www.oldboyedu.com/XinXi/
This article is from the "Automated Operations" blog, please be sure to keep this source http://pythonedu.blog.51cto.com/12741743/1923744
The advantages of the Go language