pipaaaaw 👽 (@philippaolo) header
pipaaaaw 👽 (@philippaolo) profile picture

E X P L O R E / R A N D O M N E S S

Manila
Joined April 2014
Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)Photo by pipaaaaw 👽 (@philippaolo)
pipaaaaw 👽 retweeted
Almost every software engineer has used Git before, but only a handful know how it works. To begin with, it's essential to identify where our code is stored. The common assumption is that there are only two locations - one on a remote server like Github and the other on our local machine. However, this isn't entirely accurate. Git maintains three local storages on our machine, which means that our code can be found in four places: - Working directory: where we edit files - Staging area: a temporary location where files are kept for the next commit - Local repository: contains the code that has been committed - Remote repository: the remote server that stores the code Most Git commands primarily move files between these four locations. Over to you: Do you know which storage location the "git tag" command operates on? This command can add annotations to a commit. — Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
5
146
3
728
55,420
10 Secret Websites that feel illegal to know: [🔖 Bookmark for later]
71
674
2
2,828
814,770
pipaaaaw 👽 retweeted
Explaining 7 Popular Network Protocols in 1 Diagram 🌐 With Black Friday sales coming to an end, let’s take a peek inside a typical eCommerce website and see how these popular network protocols power the online shopping spree. 1️⃣ DNS When you type the website URL into your browser, DNS translates the domain name into an IP address to locate the ecommerce servers. 2️⃣ HTTP/HTTPS Your browser communicates securely with the servers via HTTPS to fetch product info and process purchases, typically over RESTful APIs. 3️⃣ gRPC Behind the scenes, the store's microservices like order processing and payments communicate efficiently via gRPC. 4️⃣ WebSocket The website establishes a WebSocket to instantly notify your browser when payment goes through. 5️⃣ SMTP Once the order is fulfilled, SMTP sends you an order confirmation email. 6️⃣ Ping (ICMP) But what if there's a snag? Our vigilant SRE engineer pings servers with ICMP to diagnose issues. 7️⃣ Video Call (UDP) And when the going gets tough, engineers use real-time video call on UDP to resolve tricky bugs. From product listing to payment to notifications and troubleshooting - the invisible protocols work in harmony so you can shop with ease this Black Friday. Which network protocol fascinates you the most in enabling seamless digital commerce and why? – Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/496keA7
1
105
414
50,029
pipaaaaw 👽 retweeted
Explaining the 4 Most Commonly Used Types of Queues in a Single Diagram. Queues are popular data structures used widely in the system. The diagram below shows 4 different types of queues we often use. 1. Simple FIFO Queue A simple queue follows FIFO (First In First Out). An new element is inserted at the tail of the queue, and an element is removed from the head of the queue. If we would like to send out email notifications to the users whenever we receive a payment response, we can use a FIFO queue. The emails will be sent out in the same order as the payment responses. 2. Circular Queue A circular queue is also called a circular buffer or a ring buffer. Its last element is linked to the first element. Insertion takes place at the front of the queue and deletion at the end of the queue. A famous implementation is LMAX’s low-latency ring buffer. Trading components talk to each other via a ring buffer. This is implemented in memory and super fast. 3. Priority Queue The elements in a priority queue have predefined priorities. We take the element with the highest (or lowest) priority from the queue. Under the hood, it is implemented using a max heap or a min heap where the element with the largest or lowest priority is at the root of the heap. A typical use case is assigning patients with the highest severity to the emergency room while others to the regular rooms. 4. Deque Deque is also called double-ended queue. The insertion and deletion can happen at both the head and the tail. Deque supports both FIFO and LIFO (Last In First Out), so we can use it to implement a stack data structure. 🔹 Over to you: Which type of queue have you used? – Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
9
262
3
1,011
166,295
Google just launched Duet AI. Here are 6 mind-blowing features you don't want to miss: [🔖 Bookmark for later]
39
92
3
505
264,849
pipaaaaw 👽 retweeted
Microsoft Launches Copilot If you don't use it, you're falling behind Here are 20 features of Copilot helps to boost 10x Productivity & earn $$$/m
78
705
21
3,311
1,122,564
pipaaaaw 👽 retweeted
Justify-content:
55
620
20
3,364
190,361
pipaaaaw 👽 retweeted
Data is cached everywhere, from the front end to the back end! This diagram illustrates where we cache data in a typical architecture. There are 𝐦𝐮𝐥𝐭𝐢𝐩𝐥𝐞 𝐥𝐚𝐲𝐞𝐫𝐬 along the flow. 🔹 1. Client apps: HTTP responses can be cached by the browser. We request data over HTTP for the first time, and it is returned with an expiry policy in the HTTP header; we request data again, and the client app tries to retrieve the data from the browser cache first. 🔹 2. CDN: CDN caches static web resources. The clients can retrieve data from a CDN node nearby. 🔹 3. Load Balancer: The load Balancer can cache resources as well. 🔹 4. Messaging infra: Message brokers store messages on disk first, and then consumers retrieve them at their own pace. Depending on the retention policy, the data is cached in Kafka clusters for a period of time. 🔹 5. Services: There are multiple layers of cache in a service. If the data is not cached in the CPU cache, the service will try to retrieve the data from memory. Sometimes the service has a second-level cache to store data on disk. 🔹 6. Distributed Cache: Distributed cache like Redis hold key-value pairs for multiple services in memory. It provides much better read/write performance than the database. 🔹 7. Full-text Search: we sometimes need to use full-text searches like Elastic Search for document search or log search. A copy of data is indexed in the search engine as well. 🔹 8. Database: Even in the database, we have different levels of caches: - WAL(Write-ahead Log): data is written to WAL first before building the B tree index - Bufferpool: A memory area allocated to cache query results - Materialized View: Pre-compute query results and store them in the database tables for better query performance - Transaction log: record all the transactions and database updates - Replication Log: used to record the replication state in a database cluster Over to you: With the data cached at so many levels, how can we guarantee the 𝐬𝐞𝐧𝐬𝐢𝐭𝐢𝐯𝐞 𝐮𝐬𝐞𝐫 𝐝𝐚𝐭𝐚 is completely erased from the systems? – Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
6
253
3
1,023
158,300
YouTube is free education. But 98% don't know the best professors. Here are the top 7 channels to accelerate your learning:
54
1,351
15
4,450
771,869
pipaaaaw 👽 retweeted
I interviewed over 70 front-end engineers in the last 2 years. I created a new Notion "Learn Frontend Development Pack" that contains a learning path & projects to become a frontend dev with only free resources. RT and reply with "free" and I'll DM it to you. (need to follow)
2,036
1,277
86
1,951
501,915
pipaaaaw 👽 retweeted
The “System Design Fight Club” github.com/systemdesignfight… youtube.com/@SDFC
4
135
2
730
68,668
Massachusetts Institute of Technology (MIT) is offering free online courses. No Payment Needed. Here are 12 FREE courses to become skilled in 2023 : 1. Introduction to Computer Science and Programming Using Python. 🔗 lnkd.in/dDkJi23s 2. Introduction to Computational Thinking and Data Science. 🔗 lnkd.in/dBe47hMb 3. Machine Learning with Python. 🔗 lnkd.in/dKjFji7x 4. Supply Chain Analytics. 🔗 lnkd.in/dGxeBsBd 5. Understanding the World Through Data. 🔗 lnkd.in/dgsgjzVS 6. Computational Thinking for Modeling and Simulation. 🔗 lnkd.in/dTuqXerE 7. Becoming an Entrepreneur. 🔗 lnkd.in/d7YEufNe 8. Entrepreneurship 101 🔗 lnkd.in/dQ97qB9Y 9. Foundations of Modern Finance 🔗 lnkd.in/diSSBN3w 10. Entrepreneurship 103: Show Me The Money 🔗 lnkd.in/diMy8uKe 11. The Secret of Life. 🔗 lnkd.in/dezNFGXM 12. The Science of Uncertainty and Data. 🔗 lnkd.in/dKbBG9YW 13. Introduction to Computer Science and Programming in Python 🔗 lnkd.in/ddjYxxKd
53
1,305
25
2,690
546,991
Best 3 YouTube Channels To Learn…
18
617
5
2,287
204,443
pipaaaaw 👽 retweeted
Debugging is extremely important for software engineers, but it's never taught in school. Here are some top debugging techniques you can follow. – Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
3
73
2
382
39,547
pipaaaaw 👽 retweeted
What is a webhook? The diagram below shows a comparison between polling and webhook. Assume we run an eCommerce website. The clients send orders to the order service via the API gateway, which goes to the payment service for payment transactions. The payment service then talks to an external payment service provider (PSP) to complete the transactions. There are two ways to handle communications with the external PSP. 🔹 1. Short polling After sending the payment request to the PSP, the payment service keeps asking the PSP about the payment status. After several rounds, the PSP finally returns with the status. Short polling has two drawbacks: 1) Constant polling of the status requires resources from the payment service. 2) The External service communicates directly with the payment service, creating security vulnerabilities. 🔹 2. Webhook We can register a webhook with the external service. It means: call me back at a certain URL when you have updates on the request. When the PSP has completed the processing, it will invoke the HTTP request to update the payment status. In this way, the programming paradigm is changed, and the payment service doesn’t need to waste resources to poll the payment status anymore. What if the PSP never calls back? We can set up a housekeeping job to check payment status every hour. Webhooks are often referred to as reverse APIs or push APIs because the server sends HTTP requests to the client. We need to pay attention to 3 things when using a webhook: 1) We need to design a proper API for the external service to call. 2) We need to set up proper rules in the API gateway for security reasons. 3) We need to register the correct URL at the external service. -- Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
8
137
693
58,065
pipaaaaw 👽 retweeted
Visualizing a SQL query.  SQL statements are executed by the database system in several steps, including:  - Parsing the SQL statement and checking its validity  - Transforming the SQL into an internal representation, such as relational algebra  - Optimizing the internal representation and creating an execution plan that utilizes index information  - Executing the plan and returning the results  The execution of SQL is highly complex and involves many considerations, such as:  - The use of indexes and caches  - The order of table joins  - Concurrency control  - Transaction management  Over to you: What is your favorite SQL statement? —  Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/3KCnWXq
3
381
4
1,604
157,055
pipaaaaw 👽 retweeted
Sidebar is one of the most common type of navigation for desktop apps. Get inspired with this example! 🚀
19
268
1,683
168,816
pipaaaaw 👽 retweeted
Top 7 Ways to 10x Your API Performance 1. Pagination This is a common optimization when the size of the result is large. The results are streaming back to the client to improve the service responsiveness. 2. Asynchronous Logging Synchronous logging deals with the disk for every call and can slow down the system. Asynchronous logging sends logs to a lock-free buffer first and immediately returns. The logs will be flushed to the disk periodically. This significantly reduces the I/O overhead. 3. Caching We can cache frequently accessed data into a cache. The client can query the cache first instead of visiting the database directly. If there is a cache miss, the client can query from the database. Caches like Redis store data in memory, so the data access is much faster than the database. 4. Payload Compression The requests and responses can be compressed using gzip etc so that the transmitted data size is much smaller. This speeds up the upload and download. 5. Connection Pool When accessing resources, we often need to load data from the database. Opening the closing db connections add significant overhead. So we should connect to the db via a pool of open connections. The connection pool is responsible for managing the connection lifecycle. On 6 and 7, we created a video about this topic and included 2 more ways to improve performance. Watch and subscribe here: youtube.com/watch?v=zvWKqUio…
5
321
1
1,103
104,346
pipaaaaw 👽 retweeted
What does API gateway do? The diagram below shows the detail. Step 1 - The client sends an HTTP request to the API gateway. Step 2 - The API gateway parses and validates the attributes in the HTTP request. Step 3 - The API gateway performs allow-list/deny-list checks. Step 4 - The API gateway talks to an identity provider for authentication and authorization. Step 5 - The rate limiting rules are applied to the request. If it is over the limit, the request is rejected. Steps 6 and 7 - Now that the request has passed basic checks, the API gateway finds the relevant service to route to by path matching. Step 8 - The API gateway transforms the request into the appropriate protocol and sends it to backend microservices. Steps 9-12: The API gateway can handle errors properly, and deals with faults if the error takes a longer time to recover (circuit break). It can also leverage ELK (Elastic-Logstash-Kibana) stack for logging and monitoring. We sometimes cache data in the API gateway. Over to you: 1) What’s the difference between a load balancer and an API gateway? 2) Do we need to use different API gateways for PC, mobile and browser separately? — Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): bit.ly/42Ex9oZ
25
608
8
2,405
302,003
👉 Here's an amazing cheat sheet for SQL joins! Source: Ginacostag #SQL #CheatSheet #DataScience
2
398
7
1,674
205,336