Join me as we discuss various software engineering topics with examples and add fun elements to them. We always try to learn by example here in this educational Youtube channel which we believe is the right way to learn. I love Software engineering (especially the backend) and I strive to be a better software engineer every day. Join me on this journey and let us learn together.
All opinions, suggestions, and tips I provide in all of this channel's content are my own. Information provided is for educational purposes only.
Consider becoming a member to support the channel
youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join
Check out my courses
courses.husseinnasser.com
Stay awesome!
Hussein Nasser,
www.husseinnasser.com
Feel free to shoot me an email h@husseinnasser.com
twitter: @hnasr
Hussein Nasser
Let us indulge in some engineering beauties of MySQL. It rarely gets Love compared to Postgres.
Uber reduced their database locks by 94% when they upgraded to MySQL 8.0, thanks to this performance re-architecture.
We know that writing to the index may cause a structure change (btree rebalance) which can cause leaf pages, internal pages and the ROOT to split and update.
Allowing a read while the structure is being changed can cause corruptions, so we need to protect the structure and readers via physical locks or a mutexes (I talk about those in my OS course)
In version 5.6, MySQL InnoDB opted to do a global exclusive lock (X lock) on entire index when a rebalance is triggered, preventing reads from happening (reads take a shared S lock), even when the reads are going to a different part of the tree.
In 8.0 only the pages being restructured or written are X Locked (not the entire index) also a snapshot of those pages are saved so concurrent reads to those pages are allowed. This index is instead locked via a new intent SX Lock which allows shared S locks but prevents X Lock.
What better proof of this engineering marvel than Uber upgrading to MySQL 8 and reducing their database locks by 94% !
We know MySQL is struggling recently against Postgres and I covered that in another video but the engineerings marvels must be acknowledged regardless of the state of the product.
---
Watch my full deep dive coverage here
Advanced MySQL Index Locking Explained
https://youtu.be/MK24y7AmKTc
I also try to start crediting the Devs behind the work, this work is done by Zongzhi Chen
Read uber’s article www.uber.com/en-JO/blog/upgrading-ubers-mysql-flee…
1 week ago | [YT] | 318
View 14 replies
Hussein Nasser
New Backend Engineering show Episode is live, title HTTP Graceful Shutdown
There are cases where the backend may need to close the connection to prevent unexpected situations, prevent bad actors or simply just free up resources. Closing a connection gracefully allows clients and backends to clean up and finish any pending requests.
In this episode of the backend engineering show I discuss graceful connections in both HTTP/1.1 via the connection header and HTTP/2 via the GOAWAY frame.
- 0:00 Intro
- 4:58 Why shutdown connection?
- 6:46 HTTP/1.1 Graceful shutdown
- 12:26 Cost of HTTP/2
- 17:40 HTTP/2 GoAWAY frame
- 23:40 Summary
HTTP Graceful shutdown | The Backend Engineering Show
https://youtu.be/abUaM6iuElU
1 week ago | [YT] | 282
View 0 replies
Hussein Nasser
Feels great when you help a customer.
You see, 80% of your customers will use 20% of features in your software. Try to Invest in making the 20 as efficient as possible.
Fixing performance and scalability in the 20 so customers enjoy an effective experience.
2 weeks ago | [YT] | 305
View 10 replies
Hussein Nasser
The Anatomy of a WebSockets frame
With a maximum header size of 14 bytes makes more efficient for bidirectional use cases (eg chatting, gaming) compared to using long polling which has the overhead of HTTP headers.
Maximum message size can be up to 2^63 bytes
Of course being on top of TCP we suffer the head of line blocking.
3 weeks ago | [YT] | 468
View 11 replies
Hussein Nasser
Postgres 18 has been released with many exciting features such as UUIDv7, Over explain module and the most anticipated asynchronous IO with worker and io_uring mode which I uncover in this show.
0:00 Intro
1:30 Synchronous vs Asynchronous calls
3:00 Synchronous IO
6:30 Asynchronous IO
10:00 Postgres 17 synchronous io
17:20 The challenge of Async IO in Postgres 18
20:00 io_method worker
23:00 io_method io_uring
29:30 io_method sync
31:08 Async IO isn’t done!
31:30 Support for backend writers
32:36 Improve worker io_method
33:00 direct io support
Summary
YouTube link
https://youtu.be/yGjGc21mmoU?si=3FULm...
Spotify podcast link
open.spotify.com/episode/5OpiSgW4JWQPKXnBCo2yZP
3 weeks ago | [YT] | 108
View 3 replies
Hussein Nasser
If you new to backend engineering, built crud apps and want to take your skill to the next level consider grabbing the Intermediate Backend engineering Bundle. It consists of three fundamental courses in this order for an effective learning roadmap.
1- Fundamentals of Operating Systems
2- Fundamentals of Network Engineering
3- Fundamentals of Backend Engineering
The OS course polishes your knowledge about how the application work with the kernel, socket programming and file systems.
The network course introduces the bridge to the backend, how the application and the kernel sockets work the network.
Finally the backend course introduces you to the common backend design patterns how it interacts with both the OS and network to receive requests, process and write responses.
Limited offer expired Oct 5th using These coupons, you can have all three courses $29.97. Grab them now here.
OS Course coupon: OS-FALL25
www.udemy.com/course/fundamentals-of-operating-sys…
Network Course: NT-FALL25
www.udemy.com/course/fundamentals-of-networking-fo…
Backend Course: BK-FALL25
www.udemy.com/course/fundamentals-of-backend-commu…
3 weeks ago | [YT] | 324
View 9 replies
Hussein Nasser
Three conditions to evolve your software engineering skills:
1- Run into a problem you never seen before
2- Admit you don’t understand it
3- Have the interest to pursue it
The first is the opportunity, it could be an error message, a new technology, an inconsistent bug.
The second is the most important, often our ego blind us and we end up chalking this to some hand wavy explanation. You will see alot of engineers like this, they will never admit they don’t know, they will just make up stuff.
The third completes the cycle, if you are sufficiently interested you will pursue the challenge, and unlock a new skill.
Step 1 is luck
Step 2 is ego
Step 3 is spirit
Luck doesn’t mean you can’t control it, not sure how many of you watched blue lock. But there is episode discusses luck beautifully. You have to put your self in positions where luck can befell you
4 weeks ago | [YT] | 419
View 6 replies
Hussein Nasser
memory allocation is an interesting dilemma.
You can allocate exactly what you need making allocations compact and efficient. But once you start deallocating, you are left with too many tiny non-uniform gaps and fragments that cannot be reused effectively (left image).
This is known as external fragmentation. There is enough space, but it’s not contiguously allocated (scattered all over the physical memory).
So to make reallocation possible, we can instead allocate fixed-size blocks or pages. Need 8 bytes? nope you are getting 4 KiB. This model is what we mainly use today and it solves external fragmentation. You get a whole block, next allocations are essentially free (given from the same block) until you ran out of block size after which you will be given another block.
This model is predictable, and allowed us to perform virtual memory, shared memory and swap. But it is also not free, as deallocation happens, a client process may end up having 10 allocated blocks, but only using 1 byte in each block.
This is referred to as internal fragmentation. There is enough space in each of those blocks but the memory allocation software (OS) doesn’t essentially know it is used or not.
Some garbage collectors are smart enough to detect and compact internal fragmentation as long as allocation happens through that language. Ruby comes to mind. Compaction of course has a cost.
No free lunch. Either way you have to give up something, thus the dilemma.
4 weeks ago | [YT] | 394
View 6 replies
Hussein Nasser
There are two types of people.
Those who you give a destination, a desired outcome and they run and get it done.
And those who you need to give clear step by step instructions to get there. And they get you there.
I think a company needs both.
1 month ago | [YT] | 246
View 13 replies
Hussein Nasser
There is tremendous joy that can be extracted from breaking down technology to its fundamental first principles.
At first it is blurry, confusing and filled with vague abstraction.
Once understood, it is clear as day.
Only then an engineer can use the technology effectively.
1 month ago | [YT] | 489
View 4 replies
Load more