Hussein Nasser @[email protected]
464K subscribers - no pronouns :c
Join me as we discuss various software engineering topics wi
in the future - u will be able to do some more stuff here,,,!! like pat catgirl- i mean um yeah... for now u can only see others's posts :c
Data alignment is critical for CPU performance.
Many resources show how to align structures, but few explain why compilers align in the first place
I drew two diagrams to illustrate this.
For more OS fundamentals, check out my course oscourse.win
126 - 6
What Postgres and my dishwasher have in common.
In my dishwasher at least you can perform a delayed start by 4 hours to give chance to add more dishes (in case you missed some)
This reminds me of similar option in Postgres called commit_delay. When a transaction issues a commit a WAL flush to disk must be performed to ensure durability, and once started you cannot stop it (just like the dishwasher starting).
This operation is expensive. If multiple transactions commit at the same time then we incur multiple WAL flushes.
commit_delay adds few milliseconds delay to allow more transactions chance to commit (the missed dishes). This allows a single WAL flush to be executed for multiple transactions.
If you enjoy this kind of posts and illustrations check out my database and backend courses at courses.husseinnasser.com/
128 - 4
عيد اضحى مبارك وعساكم من عواده
Eid Adha Mubarak to all who celebrates
Giving back to the community a 1000 free coupons of my the following courses
Network
NT-EIDADHA2025
Node
ND-EIDADHA2025
Python
PY-EIDADHA2025
courses.husseinnasser.com/
225 - 16
The CPU is not aware of data types like long, integers, doubles. It operates on bits.
Compilers select the memory placements, alignments and instructions.
Data types alignments and misalignments are interesting and would be its own topic.
413 - 15
These two SQL queries are different for the planner.
select * from emp where id = 7
select * from emp where id = 9
The planner needs to parse, compile and produce a query plan for each one.
using bind variables avoids query parsing. Now those two hash to the same plan.
select * from emp where id = ?, 7
select * from emp where id = ?, 9
Of course this results in interesting situations.
select * from emp where id between ? and ?, 1, 3
may use the index on id, because of high selectivity.
but then reusing the same index plan for
select * from emp where id between ? and ?, 0, 9000000
may not be as efficient as doing the full scan.
Nothing is free. There is always a trade off
248 - 9
Bugs can level up a software engineer if they are truly sincere in arriving at the fundamental cause and thus getting over the bug for good.
I can argue that bugs often inspire new fantastic products. You can find a bug so severe in a piece of software that inspires you to architect a new software that is free of that bug and any manifestation of it. We see it in databases all the time.
Don’t be fooled however that your new software won’t have its own flaws that will inspire others to create their own. It is the circle of life in software engineering.
Note that Band-aiding bugs with code that one doesn’t understand (from stackoverflow, LLMs, or even trial and error) may fix the software but it will eventually create other problems.
462 - 9
When you realize that most memory copy operations use the CPU your perspective to software engineering changes.
You will begin to look at programs differently, you will see the hotspots, understand the reasoning behind senior devs pull requests, and completely comprehend fantastic talks such as this one on async io work in Postgres.
Bugs that used to be mysterious are now clear as day.
For those interested check out the Fundamentals of Operating Systems where I explore this in details. courses.husseinnasser.com/
Link to the talk
https://youtu.be/qX50xrHwQa4?si=csRf-...
188 - 2
Memory copy costs CPU.
We often call read/rcv system call to read data from a connection, example a backend reading HTTP requests.
This copies data from kernel receive buffer for that connection to user space which goes through the CPU.
This new Linux patch changes this to allow for zero copy with notification.
My video coverage on the topic
https://youtu.be/ZIORoo5oXlI
Linux patch
lore.kernel.org/io-uring/ZwW7_cRr_UpbEC-X@LQ3V64L9…
280 - 6
Reminder that the curl version that comes with OS can have bugs.
Here is a bug where the default Windows curl version is missing the TLS handshake, which was fixed back in 2021
Consider using the latest
239 - 11
Took me an hour to fix an issue where a Java app wouldn’t detect database drivers. Works on Windows, fails on Linux. Despite setting the PATH env variable.
I later learned that there is an env variable in linux LD_LIBRARY_PATH where the linker uses to lookup shared libraries which the Java needs for dynamic linking.
Once that set all worked.
No matter how insoluble a problem look at first, looking deep into the problem and understanding the fundamentals is key. In this concrete example, it is the understanding of the need of dynamically linking and the location of the lookups. Which was a missing key understanding on my end.
I compiled a set of fundamentals of backend, operating systems and databases into multiple rich courses. Check those out on my website for those interested. husseinnasser dot com
455 - 19
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 [email protected]
twitter: @hnasr