Fernando 🇮🇹🇨🇭 Profile picture
Dad and husband • Software Engineer for 15+ years • Algorithms, Distributed Systems, System Design, Computer Vision
12 subscribers
Mar 29 4 tweets 2 min read
What's the difference between load balancers, reverse proxies, and API Gateways? ↓ 1. Load Balancers

Their main job is sending client requests to several servers. The goal is to spread the load evenly so there are no bottlenecks and the system works smoothly.

They work in this way:

- The load balancer gets requests from clients

- The load balancer selects a server based on a predefined algorithm

- The request is sent to the service that was chosen

- The server processes the request and returns the response to the load balancer

- The load balancer then forwards the response back to the client

The main benefit of using a load balancer is that it increases throughput, reduces response time, and optimizes resource utilization.
Mar 19 11 tweets 3 min read
If you're a software engineer who want to get better at system design, read these 10 articles: ↓ Image 1. How Shopify uses sandboxing to build secure checkout pages

newsletter.francofernando.com/p/the-shopify-…
Mar 11 4 tweets 2 min read
What are message queues?

They are a way to let two services talk asynchronously and are critical in any distributed system.

A producer creates messages and puts them in the queue.

A consumer gets messages from the queue and processes them.

Here's a practical use case: ↓ Image Multimedia applications often need to process content to meet different users' needs.

Simply sending the request to a processing service wouldn't be a great idea because the service may not work for any reason.

A better approach is to send the request to a message queue and put the content in a file store. The queue works as a temporary buffer until the service can process the request.
Feb 18 5 tweets 2 min read
Latency and throughput are critical for any application.

But many developers get them wrong or use them in the wrong way.

Here are the key differences you should know: ↓ Image Latency is a way to measure how long an operation takes to finish.

You can think of it as the time it takes for your system to respond.

For example, latency is the time from clicking the link to when the data displays on your screen.

In computer networking, the most common latency is round-trip delay. That's the time it takes for a client request to reach the server and for the response to return.

Network latency is usually measured in milliseconds (ms) using ping tests or traceroute.
Feb 8 8 tweets 2 min read
In any coding interview, you must solve problems about arrays or strings.

I completed over 350+ of them and learned to avoid the usual mistakes.

Here are some tips that will help you improve: ↓ 1. You can efficiently access both ends of an array and use the 2-pointer technique.

2. It's usually possible optimize to O(1) space a brute force solution taking O(N) space.

3. Consider the possibility of overwriting an element instead of removing it.
Feb 1 8 tweets 2 min read
Solving 300+ LeetCode problems doesn't mean you'll pass your coding interview.

What holds you back are not your coding skills but the way you approach problems.

If you want to do better, use this practical 7-step strategy: ↓ Step 1: Listen

Pay close attention to the problem description and catch every detail.

Each piece of information is crucial in finding the optimal solution.

For example, if the interviewer gives you sorted input data, this likely affects the optimal solution.
Jan 18 7 tweets 2 min read
Many software engineers have trouble with recursion during coding interviews.

If you want to become good at solving such problems, learn these 6 templates: ↓ 1. Iteration

Any problem that can be solved with loops can also be solved using recursion.

Sometimes recursion provides a more concise and elegant solution, even if less efficient.

Example:

- traversing a linked list in reverse order
Jan 11 8 tweets 2 min read
The sliding window method isn't just a trick for coding interviews.

It's the cheat code for cracking most array and string problems.

Here's how you can quickly grasp and use it: [1/7] ↓ Image A sliding window is a subarray that moves from left to right through an array.

The window is defined by two pointers representing its left and right bound.

The window size can be fixed or variable.

[2/7]
Jan 4 5 tweets 2 min read
Most developers don't use trees in their daily work.

But the reason is that they're avoiding tree problems.

You won't need to do that anymore once you know these 4 data structures: ↓ Image 1. Binary Search Trees (BST)

It's a constrained extension of a binary tree with a unique property.

Given a node, the value of its left child is less than or equal to the parent value.

The value of the right child is greater than or equal to the parent's value

The primary use cases of BSTs are:

- implement simple sorting algorithms
- maintain a sorted stream of data
- implement double-ended priority queues

The most popular BST implementations are balanced trees like Red Black or AVL.
Dec 30, 2024 7 tweets 3 min read
Availability is critical for distributed systems.

A downtime of 1 hour:

• costs from $1K to $1M.
• affect the system credibility
• decrease the customers trust

Here's how you can get a system available: (cont'd) ↓ Image 1. Definition

Availability is a measure of how a system is resistant to failures.

The more a system stays operational when a component fails, the higher its availability.
Dec 4, 2024 6 tweets 4 min read
If you want to get better at system design and scaling apps, read these blog posts from big tech companies (Netflix, Uber, Stripe, OpenAI, Airbnb..): ↓ 1. Netflix: Extracting Image Metadata at Scale

netflixtechblog.com/extracting-ima…

2. How Uber Optimized Cassandra Operations At Scale

uber.com/en-CH/blog/how…

3. How Discord Stores Billions of Messages

discord.com/blog/how-disco…
Dec 3, 2024 4 tweets 1 min read
Caching systems play a critical role in keeping databases safe.

But what do you do if all the cache entries expire at the same time?

This kind of thing, known as a cache avalanche, leads to system crashes or degradation.

There are a few strategies you can use to mitigate the risks: ↓Image 1. Different expire dates

You can add a random number to the TTL that is associated with each cache entry.

This approach spreads out the expiration times of cached entries, making it less likely that a lot of them will expire at the same time.
Nov 30, 2024 7 tweets 2 min read
Data structures fall into one of two neat categories:

- linear, like arrays and linked lists

- non-linear, like graphs and tree

Each group has benefits and downsides.

Many developers think they're familiar with such trade-offs, but they are more subtle than they seem.

Here are the 5 key points you need to keep in mind: ↓Image 1. Arrangement of elements

• Linear: the elements are linked sequentially and can be moved through in a single run

• Non-linear: the elements are linked in a hierarchy and set up at different levels
Nov 27, 2024 13 tweets 4 min read
To become a skilled software engineer, you need to master the fundamentals.

You stand out if you know algorithms, distributed systems, and system design.

Here are 11 curated articles that will help you learn new things and get better: ↓ Image 1. The fallacies of distributed systems

Eight distributed systems fallacies that are underrated during system design.

newsletter.francofernando.com/p/the-fallacie…
Nov 20, 2024 10 tweets 4 min read
If you want to become a well-rounded software developer, read these 8 books:↓ 1. The Pragmatic Programmer by Andrew Hunt and David Thomas

It'll teach you how to improve the development process in a pragmatic way.

The book uses analogies and short stories to present development methodologies and what not to do. Image
Nov 9, 2024 5 tweets 2 min read
Don't go to a coding interview without knowing the difference between:

- Generic Trees
- Binary Trees
- Binary Search Trees

Here is all that you need to know:

[1/3] ↓ Image 1. Tree

• It is a hierarchical data structure representing relationships between different elements

• Each element is called "Node" and there is a special element called "Root Node"

• All the nodes of the tree can be accessed starting from the Root Node

• A tree is also a recursive data structure

• Each child node can be the Root of another tree known as its "Subtree"

• The number of parents of a node is always 1 and is known as its In-Degree

• The number of children of a node can differ and is known as its Out-Degree

• Other special elements in a tree are the nodes without children known as "Leaves"

• In a tree there is only 1 possible path connecting every pair of nodes
Nov 6, 2024 12 tweets 3 min read
If you want to get better at algorithms and data structures, read these 10 articles: ↓ 1. Arrays

All you need to know about the array data structure, including multidimensional and dynamic arrays.

newsletter.francofernando.com/p/arrays
Nov 2, 2024 7 tweets 2 min read
Younger engineers seems to have a hard time understanding concepts like threads, CPUs, and cores.

But I remember feeling the same way before working on embedded systems.

I hope this can help some less experienced folks out there:

[1/6] ↓ Image A thread is a sequence of instructions executed by a processor.

Two decades ago, a single chip had only a processor and one hardware thread.

So, it could only execute one set of instructions at a time.

Nowadays, CPUs can handle multiple threads.

[2/6]
Oct 30, 2024 8 tweets 5 min read
As a senior software engineer, you should read these famous white papers from big tech companies (AWS, Google, Meta,..): ↓ 1. Dynamo: Amazon’s Highly Available Key-value Store

cs.cornell.edu/courses/cs5414…

2. Spanner: Google’s Globally-Distributed Database

static.googleusercontent.com/media/research…

3. Scaling Memcache at Facebook

usenix.org/system/files/c…
Oct 29, 2024 4 tweets 2 min read
They don't ask this question in system design interviews.

But if you work with microservices, you need to know the answer.

How can you deal with tail latency?

Tail latency is when a service has rare high response times.

For example, a service typically responds in 10ms but sometimes takes 100ms.

Such rare high latencies can be very bad for systems with a lot of parts and service calls.

Tail latency can be due to many reasons: resource contention, garbage collection, or network issues.

Take a look at two common ways the front end talks with a microservices system: ↓ {1/4}Image 1. Parallel Fan-Out.

A front end service calls several back-end services at the same time and waits for all of them to reply.

The chance of getting a slow answer goes up as more calls are made at the same time.

This situation means that a slow reaction that was once rare will happen more often.

{2/4}
Oct 26, 2024 7 tweets 2 min read
The API design style determines how your apps talk to each other.

Choosing the right API can have a big effect on how well, quickly, and reliably an application works.

It is essential to pick based on what your application needs, not just what is commonly used.

Here, I compared the most well-known API designs to see what makes each stand out: ↓Image 1. SOAP (Simple Object Access Protocol)

Building web services with this design has been around for a long time.

It can work with different protocols and uses messaging based on XML.

It can use various protocols and messages that are based on XML.

It's mostly used in enterprise apps that need to follow strict rules and formal specs.