RSSAmplifier

Blog

Simon Eskildsen

Recent content from Simon Eskildsen

sirupsen.comRSS feed ↗30 posts

Latest posts

Podcast with Geek Narrator on Object Storage Databases

turbopuffer: fast search on object storage

Napkin Problem 21: Index Merges vs Composite Indexes in Postgres and MySQL

While working with Readwise on optimizing their database for the impending launch of their Reader product, I found myself asking the question: How much faster is a composite index compared to letting the database do an index merge of multiple indexes? Consider this query: SELECT count(<span

Scaling Causal's Spreadsheet Engine from Thousands to Billions of Cells: From Maps to Arrays

Causal's UI Causal is a spreadsheet built for the 21st century to help people work better with numbers. Behind Causal’s innocent web UI is a complex calculation engine — an interpreter that executes formulas on an in-memory, multidimensional database. The engine sends the result from

Metrics For Your Web Application's Dashboards

Whenever I create a dashboard for an application, it’s generally the same handful of metrics I look to. They’re the ones I always use to orient myself quickly when Pagerduty fires. They give me the grand overview, and then I’ll know what logging queries to start writing, code to look at, box to SSH into, or mitigation to activate. The same metrics are able to tell me during the day whether the…

Napkin Problem 18: Neural Network From Scratch

In this edition of Napkin Math, we’ll invoke the spirit of the Napkin Math series to establish a mental model for how a neural network works by building one from scratch. In a future issue we will do napkin math on performance, as establishing the first-principle understanding is plenty of ground to cover for today! Neural nets are increasingly dominating the field of machine learning / artificial…

Careful Trading Complexity for 'Improvements'

Often I’ve come across technical proposals along the lines of: In 6 months we will outgrow our MySQL/Postgres instance. We will need to move our biggest table to a different horizontally scalable datastore. If we have a database outage in a region, we will have a complete outage. We should consider moving to a data-store that’s natively multi-region. This would be much faster if it was stored in a…

Napkin Problem 16: When To Write a Simulator

My rule for when to write a simulator: Simulate anything that involves more than one probability, probabilities over time, or queues. Anything involving probability and/or queues you will need to approach with humility and care, as they are often deceivingly difficult: How many people with their random, erratic behaviour can you let into the checkout at once to make sure it doesn’t topple over?…

Napkin Problem 15: Increase HTTP Performance by Fitting In the Initial TCP Slow Start Window

Did you know that if your site’s under ~12kb the first page will load significantly faster? Servers only send a few packets (typically 10) in the initial round-trip while TCP is warming up (referred to as TCP slow start). After sending the first set of packets, it needs to wait for the client to acknowledge it received all those packets. Quick illustration of transferring ~15kb with an initial TCP…

Napkin Problem 14: Using checksums to verify syncing 100M database records

A common problem you’ve almost certainly faced is to sync two datastores. This problem comes up in numerous shapes and forms: Receiving webhooks and writing them into your datastore, maintaining a materialized view, making sure a cache reflects reality, ensure documents make it from your source of truth to a search index, or your data from your transactional store to your data lake or column…

Napkin Problem 13: Filtering with Inverted Indexes

Database queries are all about filtering. Whether you’re finding rows with a particular name, within a price-range, or those created within a time-window. Trouble, however, ensues for most databases when you have many filters and none of them narrow down the results much. This problem of filtering on many attributes efficiently has haunted me since Problem 3, and again in Problem 9. Queries that…

Napkin Problem 12: Recommendations

Since last, I sat down with Adam and Jerod from The Changelog podcast to discuss Napkin Math! This ended up yielding quite a few new subscribers, welcome everyone! For today’s edition: Have you ever wondered how recommendations work on a site like Amazon or Netflix?

Napkin Problem 11: Circuit Breakers

You may have heard of a “circuit breaker” in the context of building resilient systems: the art of building reliable systems from unreliable components. But what is a circuit breaker? Let’s set the scene for today’s napkin math post by setting up a scenario. Scenario’s pretty close to reality of what our code looked like conceptually when we started working on resiliency at Shopify back in 2014.…

Napkin Problem 10: MySQL transactions per second vs fsyncs per second

Napkin friends, from near and far, it’s time for another napkin problem! Since the beginning of this newsletter I’ve posed problems for you to try to answer. Then in the next month’s edition, you hear my answer. Talking with a few of you, it seems many of you read these as posts regardless of their problem-answer format. That’s why I’ve decided to experiment with a simpler format: posts where I…

Napkin Problem 9: Inverted Index Performance and Merkle Tree Syncronization

Napkin friends, from near and far, it’s time for another napkin problem! As always, consult sirupsen/napkin-math to solve today’s problem, which has all the resources you need. Keep in mind that with napkin problems you always have to make your own assumptions about the shape of the problem. We hit an exciting milestone since last with a total of 500 subscribers! Share the newsletter (ht

Adjacent Possible: Model for Peeking into the Future

There are 100s of cases of important discoveries being made independently by different people at almost exactly the same time: calculus (1600s), the telegraph (1837), the light bulb (1879), the jet engine (1840), and the telephone (1876). A recent example was Spectre/Meltdown (2018), possibly the most impactful publicly disclosed security vulnerability of the past decade. Despite its fiendish…

Napkin Problem 8: Data Synchronization

Napkin friends, from near and far, it’s time for another napkin problem! As always, consult sirupsen/napkin-math to solve today’s problem, which has all the resources you need. Keep in mind that with napkin problems you always have to make your own assumptions about the shape of the problem. Since last time, I’ve added compression and hashing numbers to the napkin math tab

Napkin Problem 7: Revision History

Napkin friends, from near and far, it’s time for another napkin problem! As always, consult sirupsen/napkin-math to solve today’s problem, which has all the resources you need. Keep in mind that with napkin problems you always have to make your own assumptions about the shape of the problem. I debated putting out a special edition of the newsletter with COVID-related napkin math problems. However,…

Napkin Problem 6: In-memory Search

Napkin friends, from near and far, it’s time for napkin problem number 6! As always, consult sirupsen/napkin-math to solve today’s problem, which has all the resources you need. Keep in mind that with napkin problems you always have to make your own assumptions about the shape of the problem. Problem 6 Quick napkin calculations are helpful to iterate through simple, naive solutions and see whether…

Napkin Problem 5: Composite Primary Keys

Napkin friends, from near and far, it’s time for napkin problem number 5! If you are wondering why you’re receiving this email, you likely watched my talk on napkin math and decided to sign up for some monthly practise. Since last, in the napkin-math repository I’ve added system call overhead. I’ve been also been working on <a href="https://github.com/sirupsen/napkin-math/blo

How does progress(1) work?

We’ll cover a neat little utility called progress(1). Many common utilities like cp or gzip don’t spit out a progress bar by default. progress finds those processes and estimates how far along they are with their operation. For example, if you’re copying a 10Gb with cp, running progress will indicate that it’s progressed 1Gb, and has another

Napkin Problem 4: Redis throughput

Napkin friends, from near and far, it’s time for napkin problem number four! If you are wondering why you’re receiving this email, you likely watched my talk on napkin math and decided to sign up for some monthly training. Since last, there has been some smaller updates to the napkin-math repository and the accompanying program. I’ve been brushing up on x86 to ensure that the

Napkin Problem 3: Membership Intersection Service

Napkin friends, from near and far, it’s time for napkin problem number three! If you are wondering why you’re receiving this email, you likely watched my talk on napkin math. This weeks problem is higher level, which is different from the past few. This makes it more difficult, but I hope you enjoy it! Napkin Problem 3 You are considering how you might implement a set-membership service. Your…

Napkin Problem 2: Expected Database Query Latency

Fellow computer-napkin-mathers, it’s time for napkin problem #2. The last problem’s solution you’ll find at the end! I’ve updated sirupsen/napkin-math with last week’s tips and tricks—consult that repo if you need a refresher. My goal for that repo is to become a great resource for napkin calculations in the domain of computers. My talk from SRECON’s video was published this week, you can see it…

Napkin Problem 1: Logging Cost

Napkin friends around the world: it’s time for your very first system’ estimation problem! Confused why you’re receiving this email? Likely you attended my talk at SRECON 19, where I said that I’d start a newsletter with occasional problems to practise your back-of-the-envelope computer calculation skills—if enough of you subscribed! Enough of you did, so here we are! Problem #1: How much will the…

2018

Every year, I spend some time reflecting on the year that passed. After reading last year’s post, I noticed a fair bit of self-indulgent tangent chasing. Most of which should likely have been separate posts. I’m attempting less of that this year. I’m continuing to evolve the format, but it’ll probably be a few years until I settle on one. Berlin Jenn took a medium-term assignment in Berlin, so a…

How I Read

Until a few years ago, I didn’t spend much time reading. Today, I spend a few hours every week reading, amounting to somewhere between 30 and 50 books a year. My reading habit has evolved significantly over the past couple of years and surely will continue to. In this post, I will describe how I approach my reading. You may think it’s elaborate (other people’s reading systems rub me the same way),…

Media Playlists

We have playlists for our favorite music, but don’t re-consume great information nearly enough. Almost certainly you’ve once watched a documentary (or read a book) about the environment, after which you ponder how to reduce your footprint: an electric car, eating less meat, or <a href="http://thec

Positive Unknown-Unknowns

When we make decisions, it’s useful to be cognizant of unknown-unknowns. Almost in every case, we think about unknown-unknowns in a negative sense. If we’re venturing into unknown territory, we accept that it’s likely we’ll stumble upon Black Swans: improbable events that throw a wrench into our plans. Typically, we’ll draw on our experience to take the path we figure has the fewest negative…

Peak Complexity

With the teams I work with, we operate with the idea of peak complexity: the time at which a project reaches its highest complexity. Peak complexity has proved a useful mental model to us for reasoning about complexity. It helps inform decisions about when to step back and refactor, how many people should be working on the project at a given point in time, and how we should structure the project.…