Hussein Nasser
@hnasr
Backend and Database Courses https://courses.husseinnasser.com YouTube http://youtube.com/@hnasr Author of https://pglocks.org Engineer @esri
All my courses and the order I recommend taking them on courses.husseinnasser.com For updated coupons courses.husseinnasser.com/coupons.txt

This is probably the most error I encountered in my career. What was yours?

I wonder whatever happened to the term “service pack”? I used to see it commonly used in the 2010s, but not anymore. Patch is preferred now. I think Microsoft might still uses it though
I believe much of the excess in current applications arises from their creation on powerful computers, which hide coding inefficiencies. Unfortunately, modern integrated development environments (IDEs) and tools also demand top-tier machines since they consume significant…
I enjoy asking this question during interviews, as it opens the door to a wide array of engaging technical discussions. It also shines light at the parts of the system that were assumed to be understood. How would you handle the cancellation of an HTTP request that started a…
In HTTP/1.1, the URL, which includes query parameters, is part of the request line. The larger the URL, the larger the request, which increases network transmission cost, kernel-userspace copy, and thus CPU. In HTTP/2, the URL gets placed as a pseudo header called colon path,…

Machines have disks attached. Each disk is visualized as an array of fixed size logical blocks( Historically referred to as sectors). Disks can be logically partitioned. Where each partition takes a start block and an end block. With that knowledge, everything above it starts…

HTTP/2 frame goes in a TLS record, which goes in a TCP segment that goes in an IP packet that goes into a data link frame. This is Matryoshka of networking.
The backend TCP kernel receive queue controls how much data the frontend can send without waiting for an ACK. If the backend is busy and doesn’t call read() fast enough, the queue fills up. Less space means a smaller window, and the frontend backs off effectively slowing down…
To check row visibility, Postgres collects all active transactions into an array and rows are checked against that list. That becomes part of the snapshot for a transaction. If a row is created by any of those transactions it is not visible. That check can get expensive if…

If you begin a Read Committed transaction (let’s call it tx1) and run a long-running SELECT statement — for example, one that performs sorts and joins on large datasets — the database takes a snapshot of the committed data at the moment the query begins. Shortly after this…
malloc takes size as input and returns a pointer to the start location of memory you requested (slightly more based on the os page size) free takes only a pointer and somehow it can tell exactly how much memory that pointer was allocated and free that much exactly. how? It…

TCP blackhole is a network phenomenon where a TCP segment smaller than the MSS but larger than a router’s MTU is dropped and the sender is never notified because ICMP has been disabled. The handshake does through but subsequent larger segments (like TLS or HTTP requests) are…
Database Indexing in real life open.substack.com/pub/hnasr/p/da…
UDP is a message protocol, whatever the user writes is treated as a unit. Problem is we are restricted by data link transmission unit (called MTU). IP which carries UDP can be fragmented, to break that large message into smallest MTU. You can also disable fragmentation but…

A request is like an arrow. its maximum speed is as it leaves the bow, then it slows down due to air and gravity. A request is at its maximum speed as it leaves the frontend’s NIC, then starts to slow down as it travels through network devices, proxies, the backend kernel, and…
Operating systems (their kernel specifically) orchestrate many processes, allow access to memory, disk, network and execute processes by scheduling them to the CPU. Sounds simple when we put it this way but this task is vast. Writing efficient programs depends on how much…

Building a correct and performant transactional system requires deep knowledge in database fundamentals, application context and workflows. First correctness: It is the skill to scope operations into atomic transactions while managing concurrency of those operations to ensure a…