Alex Xu Profile picture
Mar 7 โ€ข 4 tweets โ€ข 1 min read
Popular interview question: how to diagnose a mysterious process thatโ€™s taking too much CPU, memory, IO, etc?

The diagram below illustrates helpful tools in a Linux system.

๐Ÿ”นโ€˜vmstatโ€™ - reports information about processes, memory, paging, block IO, traps, and CPU activity. Image
๐Ÿ”นโ€˜iostatโ€™ - reports CPU and input/output statistics of the system.

๐Ÿ”นโ€˜netstatโ€™ - displays statistical data related to IP, TCP, UDP, and ICMP protocols.

๐Ÿ”นโ€˜lsofโ€™ - lists open files of the current system.
๐Ÿ”นโ€˜pidstatโ€™ - monitors the utilization of system resources by all or specified processes, including CPU, memory, device IO, task switching, threads, etc.
My book โ€œSystem Design Interview - Volume 2โ€ will be available on Amazon in about 10 days. There will be no pre-order. If you are interested, please subscribe to our mailing list and I will send you an email when the book is live. Thank you.

lnkd.in/gheFVdv3

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Alex Xu

Alex Xu Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @alexxubyte

Mar 8
*BIG* announcement:

My new book System Design Interview - An Insiderโ€™s Guide (Volume 2) will be available on Amazon soon! It is a continuation of the system design interview book series. Image
Some stats about the book:
๐Ÿ”น 13 NEW real system design interviews with detailed solutions.
๐Ÿ”น 300+ diagrams to explain how different systems work.
๐Ÿ”น 400+ pages.
๐Ÿ”น took 1.5 years to make.
My co-author @sahnlam and I have spent countless nights and weekends on the book. Our goal is to make complex systems easy to understand.

Feels so good to hold it in my hand.
Read 4 tweets
Mar 4
Design stock exchange. Letโ€™s trace the life of an order through various components in the diagram to see how the pieces fit together. Image
First, we follow the order through the trading flow. This is the critical path with strict latency requirements. Everything has to happen fast in the flow:

Step 1: A client places an order via the brokerโ€™s web or mobile app.

Step 2: The broker sends the order to the exchange. Image
Step 3: The order enters the exchange through the client gateway. The client gateway performs basic gatekeeping functions such as input validation, rate limiting, authentication, normalization, etc. The client gateway then forwards the order to the order manager. Image
Read 6 tweets
Feb 25
You probably heard about ๐’๐–๐ˆ๐…๐“. What is SWIFT? What role does it play in cross-border payments? Let's take a look.

The Society for Worldwide Interbank Financial Telecommunication (SWIFT) is the main secure ๐ฆ๐ž๐ฌ๐ฌ๐š๐ ๐ข๐ง๐  ๐ฌ๐ฒ๐ฌ๐ญ๐ž๐ฆ that links the worldโ€™s banks. 1/9
The Belgium-based system is run by its member banks and handles millions of payment messages per day. The diagram below illustrates how payment messages are transmitted from Bank A (in New York) to Bank B (in London). 2/9
Step 1: Bank A sends a message with transfer details to Regional Processor A in New York. The destination is Bank B. 3/9
Read 9 tweets
Feb 24
In modern architecture, systems are broken up into small and independent building blocks with well-defined interfaces between them. Message queues provide communication and coordination for those building blocks. Today, letโ€™s discuss at-most once, at-least once, and exactly once.
๐€๐ญ-๐ฆ๐จ๐ฌ๐ญ ๐จ๐ง๐œ๐ž
As the name suggests, at-most once means a message will be delivered not more than once. Messages may be lost but are not redelivered. This is how at-most once delivery works at the high level.
Use cases: It is suitable for use cases like monitoring metrics, where a small amount of data loss is acceptable.

๐€๐ญ-๐ฅ๐ž๐š๐ฌ๐ญ ๐จ๐ง๐œ๐ž
With this data delivery semantic, itโ€™s acceptable to deliver a message more than once, but no message should be lost.
Read 8 tweets
Feb 23
In many large-scale applications, data is divided into partitions that can be accessed separately. There are two typical strategies for partitioning data. Image
๐Ÿ”น Vertical partitioning: it means some columns are moved to new tables. Each table contains the same number of rows but fewer columns (see diagram below). Image
Horizontal partitioning (often called sharding): divides a table into multiple smaller tables. Each table is a separate data store, and it contains the same number of columns, but fewer rows.

Horizontal partitioning is widely used so letโ€™s take a closer look Image
Read 9 tweets
Feb 18
A really cool technique thatโ€™s commonly used in object storage such as S3 to improve durability is called ๐„๐ซ๐š๐ฌ๐ฎ๐ซ๐ž ๐‚๐จ๐๐ข๐ง๐ . Letโ€™s take a look at how it works. 1/7 Image
Erasure coding deals with data durability differently from replication. It chunks data into smaller pieces and creates parities for redundancy. In the event of failures, we can use chunk data and parities to reconstruct the data. 4 + 2 erasure coding is shown in Figure 1. 2/7
1๏ธโƒฃ Data is broken up into four even-sized data chunks d1, d2, d3, and d4.

2๏ธโƒฃ The mathematical formula is used to calculate the parities p1 and p2. To give a much simplified example, p1 = d1 + 2*d2 - d3 + 4*d4 and p2 = -d1 + 5*d2 + d3 - 3*d4. 3/7 Image
Read 7 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(