can be written. In the field of Internet of Things, Golang can be used to efficiently access and manage millions of devices; and use Golang's various cutting-edge technologies to analyze data in real time and create data reports. The reasons for using Golang to develop the Internet of Things platform: 1. The three authors of Go are highly capable; 2. The performance of Go is second only to C/C; 3. Getting started is very fast, and most programmers can get started in 1-2 weeks; 4. It has good concurrency characteristics; 5. It is compatible with a large number of hardware devices; 6. It has good community support; 7. It can help developers speed up with clean code.
The operating environment of this tutorial: Windows 7 system, GO version 1.18, Dell G3 computer.
If your budget is relatively small, you may want to consider using Golang first. Golang's concurrency features and excellent performance can make full use of existing hardware, unlike Java and Python, which will cause a certain amount of waste and require you to spend more money.
In the field of Internet of Things, Golang can be used to efficiently access and manage millions of devices. And use Golang's various cutting-edge technologies to analyze data in real time and create data reports.
The following are the reasons why we chose Golang to develop the ThingsPanel IoT system:
Three authors of Go They are: Rob Pike, Ken Thompson and Robert Griesemer.
Rob Pike: Was a member of the Unix team at Bell Labs and the Plan 9 operating system project. He worked with Thompson for many years and co-created the widely used UTF-8 character encoding.
Ken Thompson: Mainly the author of B and C languages and the father of Unix. Winner of the 1983 Turing Award and the 1998 National Medal of Technology. He and Dennis Ritchie are the original creators of Unix. Thompson also invented the B programming language that later derived from the C language.
Robert Griesemer: Before developing Go, he was a major contributor to Google V8, Chubby and HotSpot JVM.
GoLang is a compiled language that can be compiled into machine code, and the compiled binary file can Deploy directly to the target machine without additional dependencies. Performance is better than those of interpreted languages.
The picture below is a test. It seems that the speed of Golang is still very powerful.
Performance comparison of common languages (Picture author: I don’t want to farm)
If there is a higher Requirements, it is also possible to embed C code in Go programs so that many powerful C tool libraries can be used.
If PHP programmers switch to Golang, they can start correcting bugs in 2 days. After a few weeks, you can start working more normally.
When communicating with various technical staff, ask them how long it will take for you to switch from PHP or Java to Golang. Most of the answers are 1-2 weeks, which is also true.
This is probably the most praised feature of GoLang. It can take full advantage of multi-core capabilities. GoLang uses goroutines to achieve concurrency, and it provides a very elegant goroutine scheduler system that can easily generate millions of goroutines. Stack usage can also be expanded/shrunk dynamically, which makes memory usage smarter. This is different from Java threads, which typically only allow the creation of thousands of threads.
Various CPU architectures are supported. Whether it is an X86 server or an ARM edge device, it can be directly compiled into machine code, and the deployment is completed by throwing in a file.
A 52PHP user said on his cnblogs blog: Through super simple cross-compilation, you only need to change the environment variables. (It took me two days to compile an imagemagick to the arm platform).
If you have a lot of edge devices, Golang is a good choice.
Of course, some people say that Java and PHP are also available. The problem is that you can also deliver food while riding a donkey. The problem is how slow it is!
Without expert preaching, novices will not have a master to lead them in. Without sharing, learning becomes even more difficult. Golang has good community support.
Programming language popularity on Stack Overflow, the world's largest technical question and answer website:
Independent of any external agency (outer layer in the image below). In fact, your business rules don't know anything about the outside world.
#The general idea in the diagram is that the direction of dependence can only be from outside to inside. In other words, the outer circle depends on the inner circle, and the inner circle cannot depend on the outside. Naming and data formatting in the outer layer cannot affect the inner layer.
These simple rules and conventions ensure that the system is always easy to understand, easy to develop, and easy to maintain.
In addition to the famous Docker, it is completely implemented with GO. Kubernetes, the industry's most popular container orchestration management system, is completely implemented in GO. The subsequent Docker Swarm was completely implemented in GO. In addition, there are various famous projects, such as etcd/consul/flannel, Qiniu Cloud Storage, etc., all implemented using GO. Some people say that the reason why GO language is famous is that it has caught up with the cloud era. But why not put it another way? It is also the GO language that promotes the development of the cloud.
In addition to cloud projects, there are also companies like Toutiao and UBER, which have also used GO language to completely reconstruct their businesses.
【Related recommendations: Go video tutorial, Programming teaching】
The above is the detailed content of Can go language be used to write the Internet of Things?. For more information, please follow other related articles on the PHP Chinese website!