No video

#18 Golang - Building an Efficient Worker Pool: Mastering Concurrency in Go

  Рет қаралды 13,482

codeHeim

codeHeim

Күн бұрын

Dive deep into the world of concurrency with our comprehensive guide to creating a robust Worker Pool in Go.
👨‍💻 What You'll Learn:
Understand the basics of Goroutines and Channels, the building blocks of concurrency in Go.
Learn how to structure your tasks and worker pool for optimal resource management and efficiency.
Explore how to implement a versatile worker pool that can handle multiple types of tasks, making your application more flexible and powerful.
Watch a step-by-step coding session where we write a complete Go program demonstrating the Worker Pool in action.
📚 Resources:
Original Video: www.codeheim.i...
Source code: github.com/cod...
💬 Join the Discussion:
Have questions or insights about implementing Worker Pools in Go? Drop a comment below! Don't forget to like, share, and subscribe for more in-depth programming tutorials.
🔔 Subscribe for More:
Stay tuned for more content on Go and other programming languages by subscribing and hitting the notification bell!
#GoLang #Concurrency #WorkerPool #Programming #CodingTutorial #SoftwareDevelopment

Пікірлер: 67
@user-kq5gp2sg4m
@user-kq5gp2sg4m 6 ай бұрын
Keyboard sound is distracting a lot, cant focus on what you saying
@codeheim
@codeheim 6 ай бұрын
Thanks. Have reduced the click volume in the newer videos.
@Manwithnoname838
@Manwithnoname838 6 ай бұрын
Remove it, has no value
@MAC0071234
@MAC0071234 6 ай бұрын
Wow! When I read your comment at the start of the video, I was like "oh the keyboard is gonna be like a mechanical keyboard", but I definitely wasn't expecting THAT. LMAO. Why? Just why did you add that insane sound effect @codeheim? LOLZ.
@Leeway4434
@Leeway4434 6 ай бұрын
it is especially distracting when the audio changes speeds, thus the frequency of the keyboard clicks also change
@user-fx5li1cy5t
@user-fx5li1cy5t 6 ай бұрын
you've explained the workerpool concept very well! Thank you!
@codeheim
@codeheim 6 ай бұрын
Thank you!
@brycehenderson1187
@brycehenderson1187 6 ай бұрын
You may not see this but I was to say that this video has excellent material! Perfect primer and perfect level of detail to allow for real adaptation to projects. Thank you!
@codeheim
@codeheim 6 ай бұрын
Wow, thank you! Glad it was helpful.
@treeduck999
@treeduck999 6 ай бұрын
Is typewriter not a keyboard 😂 great material anyway! Thanks
@codeheim
@codeheim 6 ай бұрын
Thanks 😅 In the new videos, I have tuned down the volume of the keys
@marckula
@marckula 6 ай бұрын
content is good but the key clicks (in stereo ;) ) are distracting - maybe dial down the keyclick volume
@codeheim
@codeheim 6 ай бұрын
Noted!
@BrenoAlmeida
@BrenoAlmeida 6 ай бұрын
Best content for golang. Love this channel. Thank you!
@codeheim
@codeheim 6 ай бұрын
Glad you enjoy it! Much appreciated!
@marvinlnnx
@marvinlnnx 6 ай бұрын
Thank you, great job and very good explained, appreciated !
@codeheim
@codeheim 6 ай бұрын
Glad you enjoyed it!
@spartainaxe6666
@spartainaxe6666 5 ай бұрын
I am simply in aw!!! Explanation was so simple to understand
@codeheim
@codeheim 5 ай бұрын
Glad to hear that! And it was very encouraging
@user-iy7rm7dt8x
@user-iy7rm7dt8x 3 ай бұрын
Great! It is very good. Thank you very much!!!
@codeheim
@codeheim 3 ай бұрын
Glad you liked it
@krisiasty
@krisiasty 4 ай бұрын
@codeheim just curious: since you want to process at most 5 tasks concurrently, why the channel size is based on the number of tasks? Also, if you start workers before adding them to the WaitGroup, and for some reason they finish quickly enough, wg.Done will be called before wg.Add, right? Shouldn't you call wg.Add before spawning workers?
@codeheim
@codeheim 4 ай бұрын
In the real scenario, the channel size could be based on your analysis or equal to the number of cores. You are right about Wait group Add and Done.
@codeheim
@codeheim 4 ай бұрын
Thank you!
@m.e10150
@m.e10150 3 ай бұрын
Thank you very much
@dirty-kebab
@dirty-kebab 6 ай бұрын
Very nice spacing between concepts and sentences. Great animation, clear design. But that keyboard is super sharp. Maybe try Red or Brown keys, they're softer to hear!
@codeheim
@codeheim 6 ай бұрын
Thank you! Noted!
@sakibhasandev
@sakibhasandev 6 ай бұрын
Good Asmr bro. and nice video
@codeheim
@codeheim 6 ай бұрын
Glad you enjoyed
@Asswipe69
@Asswipe69 19 күн бұрын
You are clicking into my soul But still a great video
@therelatableladka
@therelatableladka 3 ай бұрын
Sir, By any chance that you are the one that narrate space television videos ? and do you use a typewriter. Man I'm dying 😂😂 By the way great content !! Thankyou ❤️
@codeheim
@codeheim 3 ай бұрын
Glad you liked it! The voice is AI generated. The typewriter sound is also computer generated.
@kartikrajput2131
@kartikrajput2131 6 ай бұрын
Love the content of this channel
@codeheim
@codeheim 6 ай бұрын
Glad you love it!
@Jarek.
@Jarek. 6 ай бұрын
5:12 shouldn't you do wg.Add() before starting the workers? Ie. before line 42
@codeheim
@codeheim 3 ай бұрын
Yes, you are right. It is a mistake
@bzeeeio
@bzeeeio Ай бұрын
I understand it is just an example and error handling is not implemented, but there are a few key points to consider: (1) Ensure that wg.Done() is called reliably by using defer. (2) Following Go naming conventions is a small issue, but it is important. (3) Closing tasksChan before all tasks are processed might lead to deadlocks." This version ensures proper grammar and clarity. ... package main import ( "fmt" "sync" "time" ) // Task definition type Task struct { ID int } func (t *Task) Process() error { fmt.Printf("Processing Task ID: %d ", t.ID) time.Sleep(2 * time.Second) return nil } type WorkerPool struct { Tasks []Task Concurrency int tasksChan chan Task wg sync.WaitGroup } func (wp *WorkerPool) worker() { for task := range wp.tasksChan { if err := task.Process(); err != nil { fmt.Printf("Error processing task ID %d: %v ", task.ID, err) } wp.wg.Done() } } func (wp *WorkerPool) Run() { if wp.Concurrency
@codeheim
@codeheim Ай бұрын
Thank you! I guess due to the deadlines I missed these points. I will keep them in mind.
@nordeenhasan6030
@nordeenhasan6030 6 ай бұрын
alot of thanks for this vedios
@squ34ky
@squ34ky 6 ай бұрын
The panned keyboard sounds are a bit much.
@codeheim
@codeheim 6 ай бұрын
Noted!
@TheBigWazowski
@TheBigWazowski 6 ай бұрын
If you’re having to manually schedule tasks for goroutines, doesn’t that kind of defeat half of their purpose
@codeheim
@codeheim 6 ай бұрын
You are right. This is just an example. Can be used in various ways.
@omarashraf4493
@omarashraf4493 6 ай бұрын
are these red switches? and great video btw
@codeheim
@codeheim 6 ай бұрын
This is the only video where I tried key sound. Many folks did not like it. Unfortunately, there is no way in KZbin to change the audio track.
@GauravSingh-hh8bw
@GauravSingh-hh8bw Ай бұрын
Bro using rusty mechanical keyboard
@maxwebstudio
@maxwebstudio 6 ай бұрын
Nice stereo recording.
@codeheim
@codeheim 6 ай бұрын
Thanks!
@maxwebstudio
@maxwebstudio 6 ай бұрын
​Nice video also btw 😅 ​@@codeheim
@base_chain_volume
@base_chain_volume 5 күн бұрын
bro is typing using suppressed ak47
@jmatya
@jmatya 6 ай бұрын
those buttons are ripping the ears off, man..
@codeheim
@codeheim 6 ай бұрын
Sorry for that. This is the only video where I tried key sound. Many folks did not like it. Unfortunately, there is no way in KZbin to change the audio track.
@yeir7cnf
@yeir7cnf 6 ай бұрын
the keyboard sounds are EXTREMELY annoying
@codeheim
@codeheim 5 ай бұрын
It happened only in this video. Please enjoy other videos.
@NestiGX
@NestiGX 6 ай бұрын
Have you thought about muting keyboard? Quite annoying in my opinion.
@codeheim
@codeheim 6 ай бұрын
Yes, in the new videos I have tuned down the volume. Unfortunately, there is no way to alter the existing video.
@user-pu8qf1wv5h
@user-pu8qf1wv5h 4 ай бұрын
plz remove the keyboard sound.
@codeheim
@codeheim 4 ай бұрын
Can not change the audio in the existing video. :(
@sefatanam
@sefatanam 3 ай бұрын
WTFFFFFFFF fuyk the keyboard sound
@timebroua
@timebroua 6 ай бұрын
Sorry buy your keyboard sounds forced me to quit from video playback
@codeheim
@codeheim 6 ай бұрын
I am sorry about that. I have reduced the volume of the clicks in the newer videos. But there is no option to alter the audio in the existing video.
@netwurst
@netwurst 6 ай бұрын
The keyboard sound is so annoying that I quit watching this video before the end. Pity because the content seemed interesting.
@codeheim
@codeheim 5 ай бұрын
This is the only video I tried with the keyboard sound. Unfortunately, I can not change the audio of the existing video. Please check other videos on the channel
@For_M.
@For_M. 3 ай бұрын
I liked your keyboard sound similar to IBM PS/2 keyboard I am not sure regarding title of episode looks like barrier en.wikipedia.org/wiki/Barrier_(computer_science)
@codeheim
@codeheim 2 ай бұрын
It is somewhat different. Barrier is for stoping the execution, but worker pool also defines how many goroutines can run at a time. Thanks. you are the first one who liked the keyboard sound.
@user-ts8rf2fo3j
@user-ts8rf2fo3j 6 ай бұрын
Pls no typing sound x)
@codeheim
@codeheim 6 ай бұрын
Yes, in the new videos I have tuned down the volume. Unfortunately, there is no way to alter the existing video.
#21 Golang - Concurrency: Pipeline Pattern
13:00
codeHeim
Рет қаралды 16 М.
Advanced Golang: Generics Explained
13:37
Code With Ryan
Рет қаралды 61 М.
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 12 МЛН
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 18 МЛН
My Dad Couldn't Believe how Tesla FSD 12.5.1.3 Handled Escaping LAX
43:50
This is why Go Channels are awesome
6:06
Web Dev Cody
Рет қаралды 10 М.
Go | 6 Unique Techniques
9:04
dadcod
Рет қаралды 2,5 М.
Concurrency in Go
18:40
Jake Wright
Рет қаралды 613 М.
How To Use Goroutines For Aggregating Data In Golang?!
17:15
Anthony GG
Рет қаралды 38 М.
This Is The BEST Way To Structure Your GO Projects
11:08
Melkey
Рет қаралды 71 М.
Открытое собеседование на Go-разработчика | Навыки
2:01:31
Эйч Навыки — менторская программа
Рет қаралды 35 М.
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 12 МЛН