Threads and Connections | The Backend Engineering Show

  Рет қаралды 63,243

Hussein Nasser

Hussein Nasser

Күн бұрын

In this episode of the backend engineering show I discuss the evolution of multi-threading apps, their pros and cons and then I go through 5 threading model and how they interleave with backend connection management between the threads and requests handlings. Enjoy
0:00 Intro
2:00 Single Threading
6:30 Multi-Threading
14:15 Connection Listener
20:15 How Connections are Established
29:00 Single Listener/Worker thread
33:30 Single Listener, Multiple Worker threads
39:00 Single Listener, Multiple Workers with load balancing
42:10 Multiple Listeners on the same port (SO_REUSEPORT)
45:20 Multiple Single Threaded Backend
Fundamentals of Networking for Effective Backends udemy course (link redirects to udemy with coupon)
network.husseinnasser.com
Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
database.husseinnasser.com
Introduction to NGINX (link redirects to udemy with coupon)
nginx.husseinnasser.com
Python on the Backend (link redirects to udemy with coupon)
python.husseinnasser.com
Become a Member on KZfaq
/ @hnasr
Arabic Software Engineering Channel
/ @husseinnasser
🔥 Members Only Content
• Members-only videos
🏭 Backend Engineering Videos in Order
backend.husseinnasser.com
💾 Database Engineering Videos
• Database Engineering
🎙️Listen to the Backend Engineering Podcast
husseinnasser.com/podcast
Gears and tools used on the Channel (affiliates)
🖼️ Slides and Thumbnail Design
Canva
partner.canva.com/c/2766475/6...
Stay Awesome,
Hussein

Пікірлер: 68
@hnasr
@hnasr 2 ай бұрын
Fundamentals of Operating Systems course oscourse.win
@ChrisGreer
@ChrisGreer Жыл бұрын
Since I am usually analyzing TCP from the wire, I’m looking forward to learning more about how the kernel handles these connections. Great topic Hussein!
@darksalmon
@darksalmon 10 ай бұрын
This guy is really easy to listen to and understand.
@rahulsingha1000
@rahulsingha1000 Жыл бұрын
Hey Hussein, Your channel has helped me understand a lot of things about how backend systems work. Appreciate the effort and time you put into making these videos.
@rankostevanovich2496
@rankostevanovich2496 Жыл бұрын
Thanks a lot! Absolutely love those long format videos
@miguelgarciadasilva
@miguelgarciadasilva Жыл бұрын
Thanks for sharing. I think many of the multithreading problems with I/O are related to the 1:1 relation between applications threads and os threads. A lot of improvements will come with virtual threads option and the scheduling by software. These abstractions over the os can give a more performant use of the underlaying resources.
@HarshKapadia
@HarshKapadia Жыл бұрын
What an amazing video! Thank you SO very much for all the effort you put in, Hussein! It helps all of us a lot. Thank you.
@sabuein
@sabuein Жыл бұрын
شكراً حبيبي حسين ويعطيك ألف عافية :)
@syedshahzaibzafar2422
@syedshahzaibzafar2422 Жыл бұрын
This is so imprtant to uncover abstracted things. Great content
@DarioMader
@DarioMader Жыл бұрын
Recently discovered your channel. Love the way you teach things.
@Joker-bt4lj
@Joker-bt4lj Жыл бұрын
Loved your way of explanation man.. great voice with expression 🙂
@mahmoudtaher5588
@mahmoudtaher5588 Жыл бұрын
I admire your way of talking
@AkashDas-kf3ye
@AkashDas-kf3ye Жыл бұрын
BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!
@oah8465
@oah8465 Жыл бұрын
The problem with multiple threads listening to the same port is that u will have the "thundering herd problem. This is why nginx favors one master thread receiving and distributing to the other worker threads. fantastic video by the way. Thx from DTC.
@dixztube
@dixztube Жыл бұрын
You’re helping me level up so much. Thank you!! I’d love an episode in Arabic!! I’m sure it’s beautiful
@kouroshtajallie1366
@kouroshtajallie1366 Жыл бұрын
Ty for sharing your knowledge ❤️
@sayonarasun1577
@sayonarasun1577 Жыл бұрын
thanks Hussein. great content as always.
@prashanttripathi5763
@prashanttripathi5763 Жыл бұрын
knowledge bomb drops & big smile on my face 😺
@bashardlaleh2110
@bashardlaleh2110 Жыл бұрын
thanks for sharing your knowledge
@42Siren
@42Siren Жыл бұрын
this video was gold for me
@saileshkarki8762
@saileshkarki8762 Жыл бұрын
great, thanks
@alibabaictsolution
@alibabaictsolution Жыл бұрын
It's working thanks my friend
@dvsingh
@dvsingh Жыл бұрын
"Threads sitting near water cooler, drinking and chatting" 🤣🤣🤣🤣
@nikbl4k
@nikbl4k Ай бұрын
im enjoying your videos.
@arunkumartj9377
@arunkumartj9377 Жыл бұрын
@Hussein, love it brah ! ...laid back, that's how it should be!
@hnasr
@hnasr Жыл бұрын
Check out my Fundamentals of Networking for Effective Backends udemy course, Head to network.husseinnasser.com for a discount coupon.
@mritunjaykumar5617
@mritunjaykumar5617 Жыл бұрын
I took your Nginx course and absolutely loved it. Right now i am going through your networking course and the intricacies I'm getting to know about, totally loved it. Just a small request if you allow me, I would really love if you could create a course on operating systems (Linux based being my favourite). It would really act like a bridge for many other people like me who primarily works as a backend developer but totally unaware of the part performed by the operating-system behind it. Oh, and I took your database course as well, just after I finish the networking, I will be going through it. So much to learn from you, you are an absolute gem. Thanks Hussein. Keep up the good work.
@sameerakhatoon9508
@sameerakhatoon9508 7 ай бұрын
​@@mritunjaykumar5617 totally, i took networking course & that had really helped me to understand networks. i would also like to request for a course on operating system, currently i am reading books to understand operating systems & course would accelerate my journey.
@maddriven07
@maddriven07 Жыл бұрын
Thanks! Great content!
@hnasr
@hnasr Жыл бұрын
Thanks Justin
@mridul1161
@mridul1161 Жыл бұрын
hussein Nasser just opens up basic of software engineering in front of us... we use this every day still know so less about them great video
@osamaalsanaani6031
@osamaalsanaani6031 Жыл бұрын
ماكنت اعرف انك تتكلم عربي 😅 مبدع اخي حسين استفدت الكثير Thanks that was an informative topic
@void_star_void
@void_star_void Жыл бұрын
Interesting take in the end for utilizing process cores using the container approach, however it doesn't simplify the concurrency problems all together. If you have multiple processes and there exists an endpoint that can for example process a customer credit charge multiple times when two similar requests come in. We still need the dedup process
@qaerdogan
@qaerdogan Жыл бұрын
If you are not building good business level on top of core level you can't avoid to face it. I suggest you to look strategy patterns and tactical patterns.
@lynxxlynxxlynxx
@lynxxlynxxlynxx Жыл бұрын
Pada pendapat saya, ini sgt benar
@manarlab84
@manarlab84 Жыл бұрын
Thank you so much - have you tried to trace a listner thread (let's say a Nodejs one) using strace and ltrace or similar tools. It will be cool to show us how things work on an operating system level in another video.
@AliHussein-go9qx
@AliHussein-go9qx Жыл бұрын
Your fifth solution is very challenging. For instance, in the case of caching contents in nginx, I am not sure if all containers can use the same nginx volume for caching
@akkimahajan6799
@akkimahajan6799 Жыл бұрын
A detailed analysis on Hotstar cricket streaming would be a great topic to talk about. Millions of concurrent users at a time.
@kevn7464
@kevn7464 Жыл бұрын
Great video Hussein! What are your thoughts on surreal db?
@rahulsingha1000
@rahulsingha1000 Жыл бұрын
Hey HUSSEIN, Can you please make a long format vide explaining about these things that we have on different OS like .bash, .zsh, .bat, etc. I have a hard time understanding what these things are and what they really do.
@testtest9273
@testtest9273 Жыл бұрын
We wants more topic on software programming
@haythamasalama0
@haythamasalama0 Жыл бұрын
🔥🔥
@sundaramjha1776
@sundaramjha1776 Жыл бұрын
AWS is very popular now, if u have an idea please create a video on AWS, Kubernetes, Netflix conductor etc. Its really difficult to understand the fundamental on other KZfaq videos. Your video we easily understand it fundamentally. Love Your work. Thanks
@miresoman1769
@miresoman1769 Жыл бұрын
I agree
@miresoman1769
@miresoman1769 Жыл бұрын
Bro please please make a video about how docker instance is framed inside the operating system. What does actually happen when running a docker container?
@sheriffola
@sheriffola Жыл бұрын
It’s all cgroups and namespaces on Linux
@miresoman1769
@miresoman1769 Жыл бұрын
@@sheriffola You're right bro. But wouldn't a detailed video of Hussein be great.?
@anchalsharma0843
@anchalsharma0843 Жыл бұрын
@@miresoman1769 +1
@vigneshwarm
@vigneshwarm Жыл бұрын
@@miresoman1769 yeah my understanding is that namespace helps the isolating part and cgroup handles the cpu allocation and stuffs. I never bothered to learn more as it was too low level for me. I'd love to see a proper explanation from Hussain
@paulosantos1289
@paulosantos1289 Жыл бұрын
Really like your videos! however, these long format ones, are sometimes hard to sit through. This is because I feel like this video could have been summarised in about 1/4th of the time. Tangents are fine but you find yourself getting lost in things that are not even properly explored and then coming back to the original thread of thought and repeating yourself. Regardless, good video overall!
@tejasarlimatti8420
@tejasarlimatti8420 Жыл бұрын
100% agreed. can you check `jordan has no life` channel. he puts out System Design / DSA videos. he's very concise and has an excellent way of explaining things. just saying it'd be great if it were more like that
@DoctorAndy46
@DoctorAndy46 Жыл бұрын
Your literal plug kind of obscures the elapsed_time:total_time and the chapter name😂
@user-jh1vx3vx1c
@user-jh1vx3vx1c Жыл бұрын
If every thread gonna accept connections, won't that interfere with a work stealing algorithms used in the runtime, f.e. like in Golang? Don't you think that deciding on the current loadness of the thread is not that flexible as detecting it on runtime?
@akashagarwal6390
@akashagarwal6390 Жыл бұрын
pls also paste the case study links u showed in the video like the ES, MongoDB & PostgreSQL?
@darpanmalhotra2
@darpanmalhotra2 Жыл бұрын
Hussein: Request you to cover SYN Cookies in a video.
@narutokunn
@narutokunn Жыл бұрын
Hey Hussien why is this one removed from Google Podcasts app??
@hnasr
@hnasr Жыл бұрын
Odd it shouldn’t be let me check
@hnasr
@hnasr Жыл бұрын
Just checked. Sounds like it’s available when you sign in to google but not available when signed out. Very odd, ill check with anchor
@narutokunn
@narutokunn Жыл бұрын
@@hnasr Actually in my case I am logged in but the most recent episode I see is the one on Memcached Architecture. Thanks for the help btw
@scottspitlerII
@scottspitlerII Жыл бұрын
How exactly does Facebook break up all of that traffic for their ip address range into one data center? Like how much traffic flows through one box before it gets forwarded down into the rest of their DC?
@alfaazfaria2056
@alfaazfaria2056 Жыл бұрын
:: is the all ipv6 address same as 0.0.0.0 for ipv4 as :: represents 0:0:0:0:0:0:0:0
@himansrivastava
@himansrivastava Жыл бұрын
How can I work with you man?
@annielee747
@annielee747 Жыл бұрын
Great to watch your videos, we are currently recruiting advertising partners. Your videos are great for their unique style and wide popularity. Our company sincerely hopes to cooperate with you and hope that we can work together.
@shasha6538
@shasha6538 Жыл бұрын
why don't you use PPT or any tool?
@TomerBenDavid
@TomerBenDavid Жыл бұрын
Why do you wear those white thingies on each side? 🤔 Its cute but curious to know why is it cancelling noise for you to concentrate? 🌞
@AmadeusMoon
@AmadeusMoon Жыл бұрын
What threads hurt you :'c
@scottspitlerII
@scottspitlerII Жыл бұрын
What’s so wrong with a bunch of parked idle threads? Aren’t they not even being scheduled until any data is ready for the to read? They are going to just use an additional like 12k of heap space wasting their stack etc. I guess what’s the downside? Won’t the greedy thread still win with the scheduler?
DNS is beautiful
41:01
Hussein Nasser
Рет қаралды 46 М.
THE POLICE TAKES ME! feat @PANDAGIRLOFFICIAL #shorts
00:31
PANDA BOI
Рет қаралды 24 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 54 МЛН
Consistent Hashing | The Backend Engineering Show
23:54
Hussein Nasser
Рет қаралды 40 М.
Cloudflare Open sources Pingora (NGINX replacement)
29:33
Hussein Nasser
Рет қаралды 29 М.
How Discord Stores Trillions of Messages | Deep Dive
1:08:33
Hussein Nasser
Рет қаралды 173 М.
C# Threads, Tasks, Multi-threading & UI Cross-threading
1:07:04
Coding a Web Server in 25 Lines - Computerphile
17:49
Computerphile
Рет қаралды 327 М.
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 632 М.
Column vs Row Oriented Databases Explained
34:16
Hussein Nasser
Рет қаралды 74 М.
The Only Unbreakable Law
53:25
Molly Rocket
Рет қаралды 319 М.
Redo, Undo and WAL logs | The Backend Engineering Show
40:41
Hussein Nasser
Рет қаралды 8 М.
Clicks чехол-клавиатура для iPhone ⌨️
0:59
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 204 М.
⚡️Супер БЫСТРАЯ Зарядка | Проверка
1:00
Опыт использования Мини ПК от TECNO
1:00
Андронет
Рет қаралды 766 М.
Как слушать музыку с помощью чека?
0:36