The power of Golang and go routines
Golang go routines

The power of Golang and go routines

Concurrency in Go is a powerful feature that allows you to efficiently execute multiple tasks concurrently. Go has built-in support for concurrency through goroutines and channels. Here are some key concepts related to concurrency in Go:

  1. Goroutines: - Goroutines are lightweight threads managed by the Go runtime.
  2. Channels: - Channels are used for communication and synchronization between goroutines.

In the screenshot above the image shows some dots clustered together. Well, those dots are actually go-routines similar to the "birds flying together/bird flocking". I bet you have seen an occurrence where thousands of birds fly in a pattern and move as a single unit.

The phenomenon of birds flying together in coordinated patterns is known as bird flocking.

since I cannot attach a video to an article I will associate this article to a post with the video of those dots acting as birds. here is the link to the video

The point is to show how effective, and lightweight a go-routine is, in this instance spinning over 500 go-routines on a machine is easy and viewable.


I cannot take credit for this work it is a tutorial called "Mastering Multithreading Programming with Go (Golang)" by James Cutajar

He talks about all the stuff necessary to understand and work with concurrency in Golang. stuff like

  • Channels
  • Weight groups
  • Mutexes
  • Atomic Variables
  • Deadlocks
  • Livelocks
  • Conditional variables among others

Golang is quite a powerful language, especially in the cloud, and as a result, companies are migrating their systems to work with Golang.

Although Microservices boosts the power of app handling traffic, Golang is quite an effective language. Its ability to utilize go-routines - a lightweight (goroutine starts with a stack space of 2KB) threads that can handle extra work

I borrowed this from Fiber - a Golang framework that shows how a game-changer Golang is

Golang frameworks performance

I hope that you find this article resourceful.


Fernando Correia

Software Developer I like C, Golang and Typescript sometimes.

8 个月

I mostly use Mux or Chi. Also 1.22 will bring new nice stuff for std lib

Anthony Miracho

Senior Golang Developer | Full Stack Developer | Golang Consultant | Website Developer

8 个月
回复
Rob van der Linde

Open Source Software Analyst / Programmer at Catalyst IT Limited

8 个月

Personally I'm not a fan of Fibre because it's built on top of FastHTTP which doesn't support every single feature Golang's builtin net/http supports. But in the Go world people are obsessed with meaningless router framework benchmarks "my router is faster than yours, look!". It's silly, because most of your speed is lost on the database and I/O, not on routing.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了