-
Kafka Dead Letter Queue
OverviewA Kafka Dead Letter Queue is an essential part of building robust, fault-tolerant data pipelines. Kafka’s distributed nature makes it highly reliable, but that does not mean every message will be successfully processed. Data errors, consum...…
-
System design - Url Shorterner
clairify requirements & back-of-the-envelope estimationurl shortern basiclly need to handle 2 flow: user give a long url, return a short url user type a short url, redirect to original urlWill cover this later, focus on algorithm & deep ...…
-
System design basic - Unique ID generator
Common way to generate Unique ID in distributed systemIn distributed system, it is not enough to rely on auto_increment provided by a transactional database.multi-master replication:Suppose we have k databases, each database increase by k, there w...…
-
System design basic - consistent hasing
Round RobinserverIndex = hash(key) % n: you have n cache servers, want to balance the load, then use: serverIndex = hash(key) % nIt is simple but when there is a server offline, n changed, it need rehashing and all server are routed to different c...…
-
System design - Rate limiter
Rate Limitera rate limiter is used to control the rate of traffic sent by a client or aservice.why prevent Dos attach to prevent prevent server overload reduce cost if using third party api, like retireve balanceimplement client side: throttle ...…
-
System design basic - Concurrency Race Condition
Race Condition…
-
System design - Payment - Amazon
Payment System - payment backend of e-commenrce appfunc: pay-in flow pay-out flownonfunc: reliability: handle failed payments reconciliationdeepDive: PSP integration reconciliation handle payment processing delays h...…
-
System design - Uber
System Design - UberReferenceFunctional Requirements1.Users should be able to see all the cabs available with minimum price and ETA2.Users should be able to book a cab for their destination3.Users should be able to see the location of the driver4....…
-
LC 75
Monotonic StackPB 739. Daily Temperaturestemperatures = [73,74,75,71,69,72,76,73]Output: [1,1,4,2,1,1,0,0]因为要找变暖的日子,也就是温度比现在大的,stack每次遇到新的element,stack里边所有比cur小的数都要pop出去,新元素就是他们要的日子class Solution { public int[] dailyTemperatures(int[] temperatu...…
-
Minimum Operations to Make All Array Elements Equal
2602. Minimum Operations to Make All Array Elements EqualInput: nums = [3,1,6,8], queries = [1,5]Output: [14,10]Explanation: For the first query we can do the following operations:- Decrease nums[0] 2 times, so that nums = [1,1,6,8].- Decrease num...…