Improve Go Concurrency Performance With This Pattern

  Рет қаралды 12,047

Kantan Coding

Kantan Coding

Күн бұрын

🌟 Hey devs! 🌟
Ready to level up your coding game? Check out this awesome course on Microservices using Go!
🚀 From beginner to pro, learn to build scalable apps with ease. Don't miss out!
Enroll now: 👉 kantan-coding.teachable.com/p...
#golanguage #Microservices #CodeWithConfidence 🔥🎉
________________________________________________________________________________________________
More advanced concurrency patterns and concepts in the Go Programming language!
Pointers: • Learn golang pointers ...
Concurrency Patterns: • Master Go Programming ...
☠️ Course Contents ☠️
🔎 (0:00:00​) Intro
🔎 (0:01:16) Mutexes, Locks, and Race Conditions Oh My!
🔎 (0:04:05) Prerequisites
🔎 (0:04:35) Not Confinement
🔎 (0:13:12) Refactor with Mutex
🔎 (0:21:28) Refactor with Confinement
🔎 (0:26:22) Confinement Explained Once And For All
🔎 (0:33:30) Support Quality Content
Book on Concurrency in Go: www.oreilly.com/library/view/...

Пікірлер: 63
@kantancoding
@kantancoding 3 ай бұрын
🌟 Hey devs! 🌟 Ready to level up your coding game? Check out this awesome course on Microservices using Go! 🚀 From beginner to pro, learn to build scalable apps with ease. Don't miss out! Enroll now 👉 kantan-coding.teachable.com/p/early-bird-special-pricing #GoLang #Microservices #CodeWithConfidence 🔥🎉
@arkantos14821
@arkantos14821 10 ай бұрын
so we start with 1- coarse Locks, and then to 2- finer locks, and then to 3- enough precise memory access patterns which doesn't require locking (since there is no sharing memory) Great Job Kantan, I really enjoy your videos in golang !!
@kantancoding
@kantancoding 10 ай бұрын
Thank you! I really appreciate your support and I’m glad that the videos are helpful 😊❤️
@Honest_Market
@Honest_Market 10 ай бұрын
It's a request to you please don't stop posting this type of valuable content for us.
@kantancoding
@kantancoding 10 ай бұрын
Hi! Thank you for your support. New concurrency video coming soon 😊
@nitishagrahari9943
@nitishagrahari9943 10 ай бұрын
Yeahh.... Thank you kantan❤❤
@kantancoding
@kantancoding 10 ай бұрын
My pleasure 😊
@paulclarke4099
@paulclarke4099 10 ай бұрын
Thank you, your videos and content are great 💯😃👍
@kantancoding
@kantancoding 10 ай бұрын
Happy to help 😊 and thank you!
@dennisboachie1817
@dennisboachie1817 9 ай бұрын
You're a never disappointing life saver!
@kantancoding
@kantancoding 9 ай бұрын
I’m glad it was helpful! 😊
@aghileslounis
@aghileslounis 5 ай бұрын
Excellent
@user-cf9se4qz6t
@user-cf9se4qz6t Ай бұрын
So helpful
@ilariacorda
@ilariacorda 4 ай бұрын
The quality of this content is amazing, well done!
@kantancoding
@kantancoding 4 ай бұрын
Much appreciated! I’m glad you enjoy it 😊
@ttybitnik
@ttybitnik 5 ай бұрын
Respect. Every piece of content I've watched from you is flawless. Your drawings and explanations are spot on. Thanks a lot for taking the time to share your knowledge.
@kantancoding
@kantancoding 5 ай бұрын
Thank you! It’s always reassuring to see people actually appreciate the amount of effort I put in. Sometimes I feel like people only want to see overly simplified gimmicky content 🫠
@megadrocks
@megadrocks 10 ай бұрын
Bruh, I have a Go interview tomorrow, just finished your Master Go Programming With These Concurrency Patterns video, and watching this now. A big thank you for this content.
@kantancoding
@kantancoding 10 ай бұрын
No problem brother! Good luck with your interview 🚀
@AlfredLotsu
@AlfredLotsu 10 ай бұрын
hey how did it go?
@sarcasticdna
@sarcasticdna 8 ай бұрын
how did it go?
@IkraamDev
@IkraamDev 5 ай бұрын
did it go?
@metachain5345
@metachain5345 4 ай бұрын
Unfortunately He's fail his interview
@milanutekal5083
@milanutekal5083 10 ай бұрын
excellent content
@kantancoding
@kantancoding 10 ай бұрын
Thank you! ❤️
@henrmota
@henrmota 6 ай бұрын
Excelent video. For me confinment it was easy to understand because I already knew how an array/slice is stored in memory. Never tought about this pattern, and it is really cool and an elegant solution.
@kantancoding
@kantancoding 5 ай бұрын
Thank you! I’m glad it was interesting for you as well 🙂
@rishirajrao5337
@rishirajrao5337 2 ай бұрын
Excellent explaination. Thank you!
@kantancoding
@kantancoding 2 ай бұрын
Happy to help brother!
@sainipankaj
@sainipankaj 9 ай бұрын
Nice explaintion , Commenting for better reach Got the new way to handle the Datastructure and also learnt we have to always very cautious what we are writing
@kantancoding
@kantancoding 9 ай бұрын
Commenting really helps so thank you!! ❤️
@lsdc1
@lsdc1 5 ай бұрын
Thank you for your channel Excellent resource Gifted teacher
@kantancoding
@kantancoding 5 ай бұрын
Thank you! I’m glad it helps 😊
@nanonkay5669
@nanonkay5669 10 ай бұрын
Early gang lets go!!!! I get it, basically each goroutine is only going to changing a value at a particular address in memory. It has no idea about the array it is changing.
@kantancoding
@kantancoding 10 ай бұрын
Yes! I hope it helped! 😊
@nanateinumondestanley7819
@nanateinumondestanley7819 3 ай бұрын
God bless you for this video bro.
@kantancoding
@kantancoding 3 ай бұрын
I’m happy to help brother ❤️
@bhaveshmuleva2352
@bhaveshmuleva2352 10 ай бұрын
Hey your videos are really good ❤ Can you make one video on "learn go programming by contributing to open source" You can too suggest some best open source golang projects out there to contribute Would love to see this Thanks ✌️
@kantancoding
@kantancoding 10 ай бұрын
Hmm, I don’t really know what the video would consist of. I mean of course, the more you contribute to open source, the better you will become.. but I don’t really have anything specific to say other than, just keep contributing to open source. Also, literally any open source project is fine imo. Thank you for the suggestion! 😊 If you have additional details please let me know!
@KevinDevops
@KevinDevops 5 күн бұрын
This is one of the best golang concurrency explanation, thanks for sharing Sir Anyway is there any group of Golang community that I can join to keep improving my golang knowledge?
@Nenad_bZmaj
@Nenad_bZmaj 5 ай бұрын
Thank you. Nice. Just a remark: there are no shared resources in you example for confinement pattern. When shared resourced do exist, the confinement pattern is more complicated and involves channels.
@kantancoding
@kantancoding 5 ай бұрын
🤔
@Nicholascarballo
@Nicholascarballo 10 ай бұрын
Aren’t slices, maps and channels passed by “reference” in func arguments? In that case, I believe that just passing the variable result as argument without its reference will lead to the same results.
@kantancoding
@kantancoding 10 ай бұрын
So slices are a bit confusing but let me try to explain. In Go, slices are passed by value but a slice value is a header describing a section of a backing array. So if we just pass result in instead of a pointer to result, processData will basically just receive it’s own copy of a header to the same backing array. And when we append to that slice in processData, it will only modify the slice or header in the scope of processData. Since the slice in main() is a different slice.. it won’t get modified. Therefore, in each go routine, it will have its own slice… and append the processed data to it… then once that go routine finishes.. the processed data in the slice within the scope of that go routines processData call will be removed from the stack. So the end result is that the result slice in main() will be empty since each go routine was appending to its own slice. You can actually test this behavior quite easily. Just try it the way you mentioned and print the result both inside of processData and in main and you’ll see what I mean 👍
@Nicholascarballo
@Nicholascarballo 10 ай бұрын
@@kantancoding Indeed, under the hoods things can get overly complicated, but you managed to summarize the whole concept. I’ve just re-watched your video on mastering concurrency patterns and I few this time I had a deeper understanding about your explanations. It’s a shame we can’t give more than one thumbs up to your videos.
@kantancoding
@kantancoding 10 ай бұрын
You’ve actually inspired me to make a video explaining arrays & slices in Go so thank you! ❤️ Also, I’m happy that you were able to understand things more deeply. Thank you for your support. It really means a lot to me 😊
@Nicholascarballo
@Nicholascarballo 10 ай бұрын
@@kantancoding Can’t wait to watch it!
@mailman2097
@mailman2097 Ай бұрын
❤❤❤
@anuragkothare6181
@anuragkothare6181 14 күн бұрын
Which Fonts?
@webcodeuniversity
@webcodeuniversity 6 ай бұрын
This is cool, thanks for the explanation. as a beginner in Go, is there a limit how many goroutines we can fork? I'm talking about large scale concurrency use case and wondering if we have to limit goroutines, or it doesn't matter as goroutines once they're done they get garbage collected, any details would be appreciated please, also feel free to provide any kind of resources related to this to read/watch
@kantancoding
@kantancoding 6 ай бұрын
Hey! Thanks for watching. I’d say you are limited by the host system at the very least. The degree of such a limit would likely depend on the system or machine that it’s running on. Regarding other resources, if you are focused specifically on concurrency, this video is part of a playlist of 3 videos. I’d start with the concurrency patterns video 👍
@webcodeuniversity
@webcodeuniversity 6 ай бұрын
Thanks@@kantancoding​I watched part2 just now lol and I left one question, I'll look for part 3 for sure 😄Godo stuff
@kantancoding
@kantancoding 6 ай бұрын
@@webcodeuniversity You watches part 2/2. There is a part 1/2 in the playlist.
@bpavacic
@bpavacic 5 ай бұрын
would it work if result is []char ? Coming from the C world😊 where concurrent writes to addresses that are in the same 'word' would be unsafe
@kantancoding
@kantancoding 5 ай бұрын
Hey sorry, haven’t watched this video in a while. Would what work?
@deanschulze3129
@deanschulze3129 4 ай бұрын
You've eliminated access to shared state. That's easy to do with arrays. What other data structures will this pattern work with?
@kantancoding
@kantancoding 4 ай бұрын
Think of this series as a set of tools. I’m not saying that any one tool solves ALL problems. I’m presenting an array of tools (no pun intended) but in the real world, the specific project will determine which tools are viable in a given scenario.
@thecodealchemist7095
@thecodealchemist7095 10 ай бұрын
So Mutex is like Python's GIL or like Thread.lock?
@kantancoding
@kantancoding 10 ай бұрын
I’m pretty sure the GIL is a mutex but you should confirm. As for Thread.lock, I’ve actually never used it so I don’t know. Thanks for watching! 😊
@cuberos7430
@cuberos7430 7 ай бұрын
Thansk a lot You're amazing
@kantancoding
@kantancoding 7 ай бұрын
Happy to help! Thanks for watching 🥹
learn the Go concurrency pattern that blew my mind
27:49
Kantan Coding
Рет қаралды 4,9 М.
Master Go Programming With These Concurrency Patterns (in 40 minutes)
46:15
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 19 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 87 МЛН
Пранк пошел не по плану…🥲
00:59
Саша Квашеная
Рет қаралды 6 МЛН
Concurrency in Go
18:40
Jake Wright
Рет қаралды 611 М.
Goroutines Crash Course (Mutex, Channels, Wait Group, & More!)
15:42
Master Golang with Interfaces
21:54
Kantan Coding
Рет қаралды 10 М.
Advanced Golang: Limiting Goroutines
7:31
Code With Ryan
Рет қаралды 27 М.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
ChimiChanga
Рет қаралды 60 М.
Advanced Golang: Channels, Context and Interfaces Explained
22:17
Code With Ryan
Рет қаралды 114 М.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 233 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 262 М.
Go isn’t secure?!? feat. Low Level Learning | 053
51:14
Backend Banter
Рет қаралды 40 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН