/1 How will you design the Stack Overflow website? If your answer is on-premise servers and monolith (bottom), you would likely fail the interview, but that's how it is built in reality!
The interviewer is probably expecting something at the top.
1. Microservice is used to decompose the system into small components. 2. Each service has its own database. Use cache heavily.
/3 3. The service is sharded. 4. The services talk to each other asynchronously through message queues. 5. The service is implemented using Event Sourcing with CQRS. 6. Showing off knowledge in distributed systems such as eventual consistency, CAP theorem, etc.
/4 ๐๐ก๐๐ญ ๐ข๐ญ ๐๐๐ญ๐ฎ๐๐ฅ๐ฅ๐ฒ ๐ข๐ฌ
Stack Overflow serves all the traffic with only 9 on-premise web servers, and itโs on monolith! It has its own servers and does not run on the cloud.
This is contrary to all our popular beliefs these days.
/5 ๐ Over to you: what is good architecture, the one that looks fancy during the interview or the one that works in reality?
/1 Why do we use ๐๐จ๐ฅ๐ฎ๐ฆ๐ง-๐๐๐ฌ๐๐ ๐๐? Does column-based DB provide better performance?
The diagram below shows how data is stored in column-based DB.
/2 ๐๐ก๐๐ง ๐ญ๐จ ๐ฎ๐ฌ๐
1๏ธโฃ The table is a wide table with many columns.
2๏ธโฃ The queries and calculations are on a small number of columns.
3๏ธโฃ A lot of the columns contain a few distinct values.
/1 One picture is worth a thousand words. Interesting database selection trees.
iQIYI is one of the largest online video sites in the world, with over 500 million monthly active users. Let's look at how they choose relational and NoSQL databases.
/2 The following databases are used at iQIYI:
- MySQL
- Redis
- TiDB: a hybrid transactional/analytical processing (HTAP) distributed database
- Couchbase: distributed multi-model NoSQL document-oriented database
- TokuDB: open-source storage engine for MySQL and MariaDB.
/3 - Big data analytical systems, like Hive and Impala
- Other databases, like MongoDB, HiGraph, and TiKV
The database selection trees below explain how they choose a database.
/1 Payment through scanning QR code is very common but do you know how many ways there are to do it?
There are 4 ways, no matter whether youโre using PayPal, Stripe, Paytm, WeChat, or Alipay. Is this surprising to you? To understand this, we will answer to questions.
/2 The first question is who presents the QR code:
1. You can present the QR code and the merchant scans the code for payment. This is called โconsumer-presented mode, and what the merchant does is direct debit your account.
/3 2. Obviously, the other way is that the merchant presents the QR code for you to scan to pay the due amount. This is called โmerchant-presented modeโ and you grant the direct credit from your account.
/1 Why is Nginx called a โ๐ซ๐๐ฏ๐๐ซ๐ฌ๐โ proxy?
The diagram below shows the differences between a ๐๐จ๐ซ๐ฐ๐๐ซ๐ ๐ฉ๐ซ๐จ๐ฑ๐ฒ and a ๐ซ๐๐ฏ๐๐ซ๐ฌ๐ ๐ฉ๐ซ๐จ๐ฑ๐ฒ.
/2 ๐น A forward proxy is a server that sits between user devices and the internet.
A forward proxy is good for:
1๏ธโฃ Protect clients
2๏ธโฃ Avoid browsing restrictions
3๏ธโฃ Block access to certain content
/3 ๐น A reverse proxy is a server that accepts a request from the client, forwards the request to web servers, and returns the results to the client as if the proxy server had processed the request.
/1 The CAP theorem is one of the most famous terms in computer science, but I bet different developers have different understandings. Letโs examine what it is and why it can be confusing.
/2 CAP theorem states that a distributed system can't provide more than two of these three guarantees simultaneously.
๐๐จ๐ง๐ฌ๐ข๐ฌ๐ญ๐๐ง๐๐ฒ: consistency means all clients see the same data at the same time no matter which node they connect to.
/3 ๐๐ฏ๐๐ข๐ฅ๐๐๐ข๐ฅ๐ข๐ญ๐ฒ: availability means any client which requests data gets a response even if some of the nodes are down.
/2 Live streaming is challenging because the video content is sent over the internet in near real-time. Video processing is compute-intensive. Sending a large volume of video content over the internet takes time. These factors make live streaming challenging.
/3 The diagram below explains what happens behind the scenes to make this possible.
Step 1: The streamer starts their stream. The source could be any video and audio source wired up to an encoder