logo
episode-header-image
May 2022
9m 12s

Software engineering and Nursery rhymes

Hussein Nasser
About this episode

As a new parent, you get exposed to a whole new world. There is this new toddler song “Five little monkeys jumping on the bed” where it starts with five monkeys jumping on the bed and one falls off the bed and the mom calls the doctor and then another monkey falls and the mom calls the doctor again. This keeps going until all monkeys are no longer on the bed.

This clearly looks like a software engineering problem. In the face of it is extreme inefficiency in IO with the mom calling the doctor 5 times in span of 3 minutes. The mom could decide to wait for all monkeys to fall and call the doctor once. A Method that is known as batching.

Two problems with this approach; the first is latency the mom can’t wait, she is worried, she needs immediate answer from the doctor for the first monkey that fell.

The second problem is we don’t know if more monkeys are going to fall off the bed, so while the mom waiting, the first monkey will be in pain and will “starve”.

We makes decisions like this constantly in software engineering. In some database systems for example commits from transactions are grouped and batched for few microseconds/milliseconds so more commits can arrive and the database can flush/fsync the WAL once. This is specially important in highly concurrent system because disk fsync is costly and bypasses the operating system cache. However, this comes at a cost of slight delay in transaction commits but less IO in general.

To batch or not to batch. The five little monkey problem doesn’t have one right solution it all depends.

--- Support this podcast: https://anchor.fm/hnasr/support
Up next
Jun 13
kTLS - Kernel level TLS
Fundamentals of Operating Systems Course https://oscourse.winktls is brilliant.TLS encryption/decryption often happens in userland. While TCP lives in the kernel. With ktls, userland can hand the keys to the kernel and the kernel does crypto. When calling write, the kernel encryp ... Show More
22m 55s
May 9
The beauty of the CPU
If you are bored of contemporary topics of AI and need a breather, I invite you to join me to explore a mundane, fundamental and earthy topic.The CPU.A reading of my substack article https://hnasr.substack.com/p/the-beauty-of-the-cpu 
9m 38s
Apr 18
Sequential Scans in Postgres just got faster
This new PostgreSQL 17 feature is game changer. They know can combine IOs when performing sequential scan. Grab my database coursehttps://courses.husseinnasser.com 
27m 36s
Recommended Episodes
Oct 2023
Song for kids: Five Little Monkeys
「當我意識到自己的一無是處,我發現生命珍貴了起來。」 K6劉家凱《太棒了!我一無是處的人生》打破傳統的演唱專輯形式! 以樂手身份為本位,與7位歌手合作,包括:陳珊妮、曹雅雯、洪佩瑜、劉以豪、Kivi、桃子A1J、Betie。 ?線上收聽: https://bit.ly/3Q4C3b7 ----以上訊息由 SoundOn 動態廣告贊助商提供---- Five little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the do ... Show More
3m 33s
Sep 2022
Five Little Monkeys
Five little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the doctor said "No more monkeys jumping on the bed!" Four little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the doctor said "No more mon ... Show More
3m 33s
Dec 2022
Five Little Monkeys
Five little monkeys jumping on the bed song Five little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the doctor said "No more monkeys jumping on the bed!" Four little monkeys jumping on the bed One fell off and bumped his head Mama called ... Show More
3m 33s
Apr 2023
Five Little Monkeys Jumping on the Bed
Five little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the doctor said "No more monkeys jumping on the bed!" Four little monkeys jumping on the bed One fell off and bumped his head Mama called the doctor and the doctor said "No more mon ... Show More
3m 33s
May 2023
Episode 354: Good at circuits, bad at git and ghosts of team members past
In this episode, Dave and Jamison answer these questions: I work at a startup that makes embedded devices and the software that runs on them. Everyone on the tech team does both. We recently hired someone to lead the tech team to give the CTO more time for other duties. My new bo ... Show More
29m 7s
May 2020
Sam Newman: Monolith to Microservices
Today on the InfoQ Podcast, Wes Reisz talks with one of the thought leaders in Microservices, CI/CD, and Cloud -- Sam Newman. The podcast covers many of the topics, techniques, and patterns that Sam writes about in his latest book, Monolith to Microservices: Evolutionary Patterns ... Show More
43m 30s
Jun 2021
In Machines We Trust: When AI becomes childsplay
Despite their popularity with kids, tablets and other connected devices are built on top of systems that weren’t designed for them to easily understand or navigate. Adapting algorithms to interact with a child isn’t without its complications—as no one child is exactly like anothe ... Show More
21m 19s
Mar 2021
Hasty Treat - What is the n+1 problem?
In this Hasty Treat, Scott and Wes talk about a common problem you’ll encounter in your development career — the n+1 problem. Hasura - Sponsor With Hasura, you can get a fully managed, production-ready GraphQL API as a service to help you build modern apps faster. You can get sta ... Show More
20m 6s
Dec 2021
Initial Omicron Lab Data, Creative Naps, and Fishy Sounds.
T-Cells in vaccinated people may be holding the fort, or at least fighting serious illness, against the latest SARS CoV2 variant. Also, how the briefest of sleeps aids creativity.Prof Penny Moore, of South Africa’s National Centre for Infectious Disease and Witwatersrand Universi ... Show More
30m 42s
Jul 2021
A life-changing database
Proteomes, the sequences of protein within the DNA of every living thing, are notoriously difficult to model. The usual chemical methods can take months, but a new computational model using the ability of artificial intelligence to learn the complex sequences is able to predict s ... Show More
32m 51s