search
HomeBackend DevelopmentGolangCan go language be used to write the Internet of Things?
Can go language be used to write the Internet of Things?Dec 28, 2022 pm 04:46 PM
golangInternet of thingsgo language

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.

Can go language be used to write the Internet of Things?

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:

Founder

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.

Performance is second only to C/C

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.

Can go language be used to write the Internet of Things?

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.

#Getting started is very fast, and most programmers can get started in 1-2 weeks.

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.

Concurrency Features

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.

Compatible with a large number of hardware devices.

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!

Good community support.

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:

Can go language be used to write the Internet of Things?

##Quoted from: 2021 Programming Language Ranking, Author : Xiaoxin takes you to learn programming

You can look up information, ask questions, and someone will answer you. This is very important in development.

Help developers speed up with clean code.

"Clean architecture" is a concept proposed by Robert C. Martin (Uncle Bob) (About, Robert C. Martin Robert C. Martin's work (16)) in 2012 when he summarized the existing system architecture. .

In the article, the clean architecture he proposed is like this:

  • Independent of the framework. The architecture does not rely on the existence of some feature-rich software library. This allows you to use a wide variety of frameworks as tools.
  • Testable. Business rules can be tested without a UI, database, web server, or any other external elements (such as third-party RPC services).
  • Independent of the user interface. The user interface can be easily changed without having to change other parts of the system. For example, the web user interface can be replaced with a console interface without having to change business rules.
  • Independent of the database. You can swap Oracle or SQL Server for Mongo, BigTable, CouchDB
    or something else. Your business rules are not bound to the database.

Independent of any external agency (outer layer in the image below). In fact, your business rules don't know anything about the outside world.

Can go language be used to write the Internet of Things?

#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.

The case is convincing

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
go语言有没有缩进go语言有没有缩进Dec 01, 2022 pm 06:54 PM

go语言有缩进。在go语言中,缩进直接使用gofmt工具格式化即可(gofmt使用tab进行缩进);gofmt工具会以标准样式的缩进和垂直对齐方式对源代码进行格式化,甚至必要情况下注释也会重新格式化。

go语言为什么叫gogo语言为什么叫goNov 28, 2022 pm 06:19 PM

go语言叫go的原因:想表达这门语言的运行速度、开发速度、学习速度(develop)都像gopher一样快。gopher是一种生活在加拿大的小动物,go的吉祥物就是这个小动物,它的中文名叫做囊地鼠,它们最大的特点就是挖洞速度特别快,当然可能不止是挖洞啦。

一文详解Go中的并发【20 张动图演示】一文详解Go中的并发【20 张动图演示】Sep 08, 2022 am 10:48 AM

Go语言中各种并发模式看起来是怎样的?下面本篇文章就通过20 张动图为你演示 Go 并发,希望对大家有所帮助!

【整理分享】一些GO面试题(附答案解析)【整理分享】一些GO面试题(附答案解析)Oct 25, 2022 am 10:45 AM

本篇文章给大家整理分享一些GO面试题集锦快答,希望对大家有所帮助!

tidb是go语言么tidb是go语言么Dec 02, 2022 pm 06:24 PM

是,TiDB采用go语言编写。TiDB是一个分布式NewSQL数据库;它支持水平弹性扩展、ACID事务、标准SQL、MySQL语法和MySQL协议,具有数据强一致的高可用特性。TiDB架构中的PD储存了集群的元信息,如key在哪个TiKV节点;PD还负责集群的负载均衡以及数据分片等。PD通过内嵌etcd来支持数据分布和容错;PD采用go语言编写。

go语言能不能编译go语言能不能编译Dec 09, 2022 pm 06:20 PM

go语言能编译。Go语言是编译型的静态语言,是一门需要编译才能运行的编程语言。对Go语言程序进行编译的命令有两种:1、“go build”命令,可以将Go语言程序代码编译成二进制的可执行文件,但该二进制文件需要手动运行;2、“go run”命令,会在编译后直接运行Go语言程序,编译过程中会产生一个临时文件,但不会生成可执行文件。

go语言是否需要编译go语言是否需要编译Dec 01, 2022 pm 07:06 PM

go语言需要编译。Go语言是编译型的静态语言,是一门需要编译才能运行的编程语言,也就说Go语言程序在运行之前需要通过编译器生成二进制机器码(二进制的可执行文件),随后二进制文件才能在目标机器上运行。

golang map怎么删除元素golang map怎么删除元素Dec 08, 2022 pm 06:26 PM

删除map元素的两种方法:1、使用delete()函数从map中删除指定键值对,语法“delete(map, 键名)”;2、重新创建一个新的map对象,可以清空map中的所有元素,语法“var mapname map[keytype]valuetype”。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!