Pinned Tweet
Classic pagination bug: a product search feels instant on the first few pages, then gets slower the deeper it goes. A few hundred pages in, response times stretch into seconds and CPU usage goes up. OFFSET is the culprit, and the fix is a one-line change to the query.
Private IP ranges (RFC 1918):
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
Routers on the public internet don't forward them. That's why every home and office network can reuse the same addresses.
5
272
Node.js executes JavaScript on a single thread, yet one Node server handles thousands of requests at once.
Issue 1 of The Happy Path newsletter explains how the event loop makes that possible, one diagram at a time.
buttondown.com/TheHappyPath/…
JavaScript Quiz: what's the output of this code?
A) [1, 2, 3]
B) [NaN, NaN, NaN]
C) [1, NaN, NaN]
D) ["1", "2", "3"]
2
11
1,243
DNS record types:
A DNS lookup doesn't always return an IP address. A and AAAA records do, but a CNAME points to another name, MX names the mail server, TXT carries text for checks like SPF, and NS names the servers that store the domain's official records.
AWS vs Google Cloud vs Azure:
The three clouds sell the same building blocks under different names. EC2, Compute Engine and Virtual Machines are all rented servers. S3, Cloud Storage and Blob Storage all store files as objects.
Here are six common ones mapped across all three:
AWS quiz.
Four core AWS services and their jobs:
- Compute: EC2
- Storage: S3
- Databases: RDS
- Monitoring: IAM
Which pairing is wrong?
How does a CDN speed up requests?
The first request for a file goes all the way to the origin server. Later requests are served from a copy on an edge server close to the user.
JavaScript Quiz: what's the output of this code?
A) [1, 2, 10]
B) [1, 10, 2]
C) [10, 2, 1]
D) [2, 1, 10]
B. thumbs/cat.jpg doesn't start with uploads/, and it is thus skipped by the prefix filter.
The function is only invoked for the original upload.
The main database families:
PostgreSQL and MySQL are relational, which is one family out of eight. Document, key-value, wide-column, graph, time-series, vector and search databases each organize data around a different kind of query.
1
6
303
AWS quiz.
An S3 upload triggers a Lambda function that writes a thumbnail to the same bucket. The trigger only fires for keys starting with uploads/. Thumbnails go to thumbs/.
A) each thumbnail triggers the function again
B) thumbnails don't trigger it
Which one happens?
Three things break the S3 to Lambda upload pipeline:
- S3 can deliver the same event twice
- Events for one file can arrive out of order
- A handler that crashes is retried twice then the event is dropped
The fix is a queue in front and a write that checks the event's sequencer
System design question: files are uploaded to S3 through presigned URLs, and each upload has to be scanned, thumbnailed and saved to a table.
The first design is an S3 event triggering a Lambda that does all three steps.
What can go wrong with it?
1
6
468
The answer is 3.
UNION removes duplicate rows across the result.
SQL JOIN types:
INNER, LEFT, RIGHT and FULL JOIN differ in what happens to rows without a match. INNER JOIN leaves them out. The other three keep them and fill the missing side with NULL: LEFT keeps A's extra rows, RIGHT keeps B's, FULL keeps both.
The Happy Path retweeted
SQL quiz.
Table a has a column x with the values 1, 2, 2.
Table b has a column x with the values 2, 3.
What's the output of this query?
SELECT COUNT(*) FROM (
SELECT x FROM a
UNION
SELECT x FROM b
) t;
SQL quiz.
Table a has a column x with the values 1, 2, 2.
Table b has a column x with the values 2, 3.
What's the output of this query?
SELECT COUNT(*) FROM (
SELECT x FROM a
UNION
SELECT x FROM b
) t;




















