Table of Contents
Help developers speed up with clean code. " > Help developers speed up with clean code.
Home Backend Development Golang Can 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
golang Internet of things go 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 of this Website
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

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

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Which libraries in Go are developed by large companies or provided by well-known open source projects? Which libraries in Go are developed by large companies or provided by well-known open source projects? Apr 02, 2025 pm 04:12 PM

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

How to ensure concurrency is safe and efficient when writing multi-process logs? How to ensure concurrency is safe and efficient when writing multi-process logs? Apr 02, 2025 pm 03:51 PM

Efficiently handle concurrency security issues in multi-process log writing. Multiple processes write the same log file at the same time. How to ensure concurrency is safe and efficient? This is a...

What is the problem with Queue thread in Go's crawler Colly? What is the problem with Queue thread in Go's crawler Colly? Apr 02, 2025 pm 02:09 PM

Queue threading problem in Go crawler Colly explores the problem of using the Colly crawler library in Go language, developers often encounter problems with threads and request queues. �...

In Go, why does printing strings with Println and string() functions have different effects? In Go, why does printing strings with Println and string() functions have different effects? Apr 02, 2025 pm 02:03 PM

The difference between string printing in Go language: The difference in the effect of using Println and string() functions is in Go...

What libraries are used for floating point number operations in Go? What libraries are used for floating point number operations in Go? Apr 02, 2025 pm 02:06 PM

The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? How to solve the user_id type conversion problem when using Redis Stream to implement message queues in Go language? Apr 02, 2025 pm 04:54 PM

The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

How to use Golang to implement Caddy-like background running, stop and reload functions? How to use Golang to implement Caddy-like background running, stop and reload functions? Apr 02, 2025 pm 02:12 PM

How to implement background running, stopping and reloading functions in Golang? During the programming process, we often need to implement background operation and stop...

How to solve the problem of Golang generic function type constraints being automatically deleted in VSCode? How to solve the problem of Golang generic function type constraints being automatically deleted in VSCode? Apr 02, 2025 pm 02:15 PM

Automatic deletion of Golang generic function type constraints in VSCode Users may encounter a strange problem when writing Golang code using VSCode. when...

See all articles