- THE Travis Media Newsletter
- Posts
- 🌎️ How Facebook Serves Billions of Users
🌎️ How Facebook Serves Billions of Users
And exploring randomness in JavaScript
Hey there!
Last week I asked the audience which AI you used the most, and ChatGPT was by far the winner. It makes sense given ChatGPTs whopping $3.4 billion in annualized revenue.
🟩🟩🟩🟩🟩🟩 ChatGPT
🟨⬜️⬜️⬜️⬜️⬜️ Claude
🟨⬜️⬜️⬜️⬜️⬜️ Microsoft Copilot
🟨🟨⬜️⬜️⬜️⬜️ Perplexity
B.R: “My employer provides ChatGPT Enterprise and github copilot, but I usually find the code better in chatgpt. From what I understand, chatgpt 4o is not yet used in copilot.”
P.A: “Meta AI on Whatsapp”
Now, I’d love to learn a little more about you so that I can ensure my content is providing value.
What's your experience with software development? |
PROGRAMMING
Marcus has worked at Apple, OpenSea, and started his own company. He finally feels like he's a decent programmer, so he's sharing advice with the idea of "what would have gotten him here faster?"
If you (or your team) are constantly shooting yourselves in the foot, fix the gun
He's been on teams where the system is easy to mess up, but no one fixes it. This isn't about calling out people, but these issues linger because there's never a good time to address them.
Assess the trade-off between quality and pace
There's always a balance between speed and correctness. Ask: how okay is it to ship bugs right now? If this doesn't change your work approach, you're too inflexible.
Spending time sharpening the axe is almost always worth it
You'll rename things, go to type definitions, find references, etc., a lot; be fast at this. Know all major shortcuts in your editor. Be a confident typist. Know your OS well. Be proficient in the shell. Use browser dev tools effectively.
If you can’t easily explain why something is difficult, it’s incidental complexity, worth addressing
His favorite manager pressed him when he claimed something was hard to implement. Most complexity was incidental and often fixable.
Other tips include:
Try to solve bugs one layer deeper
Don’t underestimate the value of investigating bug history
Bad code gives feedback, perfect code doesn’t. Err on the side of writing bad code
Make debugging easier
When on a team, usually ask the question
Shipping cadence matters a lot. Think hard about what will get you shipping quickly and often
Quick Links
⁉️ Exploring Randomness In JavaScript
From a security standpoint, "randomness" means that a random number generator produces sequences that attackers can't predict. In contrast, for tools like a random color palette generator, randomness is about the user's perception, this blog post explores those differences.
😿 The Demise of the Mildly Dynamic Website
PHP enabled dynamic web applications for the masses. Whilst PHP led to the rise of "mildly dynamic" websites, the advent of static site generators has led to these mildly dynamic websites largely fading away.
🗞️ A large-scale structured database of a century of historical news
Historically, U.S. local newspapers relied heavily on newswires like the Associated Press, which helped create a national identity. This research reconstructs a comprehensive newswire archive using a customized deep learning pipeline on hundreds of terabytes of raw image scans from thousands of local newspapers.
🌌 Software Galaxies
Seriously just check this out, it’s awesome.
Programmers should be paranoid.
“I double-checked the code.”
“The code passes the tests.”
“The reviewer approved my code.”
“So is my code correct?”
Writing code correctly is hard and verifying code correctness is nearly impossible. Here’s why:
Generality: Even if your code behaves correctly once, will it do so for all cases, machines, and times?
False Pass: Failing tests indicate bugs, but passing tests do not guarantee their absence.
Lack of Certainty: You could write a formal proof of your code’s correctness, but now you must wonder if the proof itself is correct, leading to an endless verification chain.
Chasing certainty in code correctness is futile. Bugs may lurk in dependencies you'll never find. However, by striving for a greater understanding and exercising due diligence, you can reduce the risk of bugs. Abstractions Understanding abstractions is crucial. Abstractions are mental models of how things work, simplifying complex realities. They help us see the forest for the trees and are used constantly in programming and daily life. So why do abstractions fail?
BIG TECH
How Does Facebook Manage to Serve Billions of Users Daily?
Even great software projects can start. Most begin with a simple stack: such as the MERN stack. And of course, this setup is often initially sufficient and can last a while if scaling isn't required.
But as the project grows to serve millions or billions of users, relying solely on a database can start to slow the system down. Big companies like Facebook adopt caching to scale efficiently by supporting the database.
What is a cache?
Cache stores data to quickly serve future requests. Its power lies in anticipating requests and pre-storing the data likely to be needed. For instance, when a friend posts an update on social media, it's expected to appear in your feed. The platform stores this in cache so it's instantly available, avoiding slower database queries.
Memcache: Facebook’s caching system
Memcached is a high-performance caching system. Facebook built upon it to build their own distributed caching framework.
Features of Memcache enabling Facebook’s scalability:
Parallel requests with DAG: Logically independent data can be retrieved in parallel.
Batching requests: Memcache collects and sends multiple requests to the cache storage simultaneously, reducing latency.
Leasing: This method solves issues with stale sets and thundering herds. A client gets a "lease" to set data, verified with a 64-bit token key, ensuring data consistency.
The full blog post goes into great detail on how these features enable Facebook to efficiently serve billions of requests.
a day in the life of a react native software engineer
— David Leuliette (@flexbox_)
8:25 PM • Jun 28, 2024
How do C++, Java, Python work
— Interesting STEM (@InterestingSTEM)
8:24 AM • Jul 1, 2024
Until next week,
Travis.
Reply