perpetually curious, occasionally enlightened, never particularly skilled

Joined September 2021
I aspired to become a doctor in accordance with my late mother's wish, but I was unable to fulfil this ambition. Rather than pursuing a university education, I chose to join LeT, influenced by a man (Hafiz Saeed) who adversely impacted my promising future. I recall being assigned the duty of guarding him in Muridkay, which served as his permanent residence and head office at that time. He previously travelled in a blue Toyota Vigo pickup Datsun, which had been modified with a comfortable sleeping area in the rear for his use. Many youths, motivated by his speeches, joined LeT and subsequently travelled to Afghanistan and Indian Kashmir. Unfortunately, the majority did not return. Every Thursday, approximately 500 individuals from across the country travel to Afghanistan to undergo training at a camp named Ma’askar Tayyba located in Kunar Province. I chose to leave LeT when its true face became clear to me in Afghanistan and Kashmir (Pakistani). I recall when the LeT commanders referred to me as a coward upon hearing of my decision to depart from the death cult. LeT currently has a force of approximately one million trained militants which established itself as a significant entity within the state. He is responsible for the deaths of thousands of Pakistanis by sending them in a war of ashes to achieve state’s political goals. I wish to see his disgraceful end in my life. In Shaa Allah I’m in a better place than Hafiz Saeed desired for me because Allah has chosen me to expose the dark faces of Islamists. Alhamdulillah
549
6,495
803
22,509
2,798,398
Great to meet you once again, Prime Minister @narendramodi ji, at Paris!
202
1,031
67
26,275
573,208
𝗖𝗔𝗣 𝗧𝗛𝗘𝗢𝗥𝗘𝗠 📌
3
9
44
5,219
When you are running a simple monolith application, all your services run on the same set of instances. Successful applications have a habit of growing over time and eventually becoming huge. Once your application become huge, it’s becomes a monstrous monolith
3
9
68
13,289
𝗛𝗼𝘄 𝘁𝗼 𝗽𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻 𝗱𝗮𝘁𝗮 𝗮𝗰𝗿𝗼𝘀𝘀 𝘀𝗵𝗮𝗿𝗱𝘀 ? 🧵
2
13
103
12,489
𝗟𝗲𝘁'𝘀 𝗴𝗲𝘁 𝗶𝗻𝘁𝗿𝗼𝗱𝘂𝗰𝗲𝗱 𝘁𝗼 𝘀𝗵𝗮𝗿𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗽𝗮𝗿𝘁𝗶𝘁𝗶𝗼𝗻𝗶𝗻𝗴. 🧵
6
35
1
181
41,961
DynamoDB provides 4 nine availability. And in the event the dynamoDB does not meet this commitment, AWS compensates consumers. All public cloud follow this rule When you say a system is available, what does it mean ?
3
5
1
36
4,601
i love react
2
3
32
3,224
This one thread will teach you everything that you need to know about 𝗗𝗡𝗦 ( 𝗗𝗼𝗺𝗮𝗶𝗻 𝗡𝗮𝗺𝗲 𝗦𝘆𝘀𝘁𝗲𝗺 ) 📌 🧵
4
22
123
37,708
𝗠𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 📌 Let's take a look at some of the common components in a typical microservice architecture. ⚡️𝗖𝗗𝗡𝘀 (𝗖𝗼𝗻𝘁𝗲𝗻𝘁 𝗗𝗲𝗹𝗶𝘃𝗲𝗿𝘆 𝗡𝗲𝘁𝘄𝗼𝗿𝗸) CDNs are a collection of geographically distributed servers. CDNs mostly hosts static content (images, js file etc). Think of CDN server as a read through cache server. If the requested file is present on this cache server, it is returned immediately. And if the file is not present, the CDN server makes a call to your web server to retrieve and cache the file for all subsequent requests. Benefits: 🔹CDN improve read latency 🔹it helps improve read scalability 🔹it helps improve reliability 🔹it makes system resilient again DDoS attack ⚡️𝗥𝗲𝘃𝗲𝗿𝘀𝗲 𝗽𝗿𝗼𝘅𝘆 Reverse proxy is a server sitting in front of one of more application servers. It keeps original servers hidden and protects servers from malicious client requests. Benefits: 🔹Privacy and protection of backend services 🔹Security 🔹Load balancing ⚡️𝗟𝗼𝗮𝗱 𝗯𝗮𝗹𝗮𝗻𝗰𝗲𝗿 Load balancer is a server that is used to distribute the incoming requests evenly among a cluster/group of instances. Load balancer ensures that no single server is overwhelmed with traffic and improves the overall availability and reliability of a system. Benefits: 🔹Traffic distribution 🔹Health checks 🔹High availability 🔹Scalability ⚡️𝗔𝗣𝗜 𝗴𝗮𝘁𝗲𝘄𝗮𝘆 API gateway is a specialised implementation of reverse proxy. It's a server that acts as a single entry point for all API calls from clients to your backend services. It is used to route your API request to the corresponding service instance. Benefits: 🔹Request routing 🔹API management 🔹Authorisation 🔹Rate limiting 🔹Caching ⚡️𝗜𝗱𝗲𝗻𝘁𝗶𝘁𝘆 (𝗮𝘂𝘁𝗵𝗲𝗻𝘁𝗶𝗰𝗮𝘁𝗶𝗼𝗻) 𝗽𝗿𝗼𝘃𝗶𝗱𝗲𝗿 Identity provider is responsible for user management and access control. All client's requests need to be authenticated before they are allowed to access the backend services. Identity provider abstracts this task of user validation into separate manageable service. Benefits: 🔹Authentication 🔹Authorization 🔹Access control ⚡️𝗦𝗲𝗿𝘃𝗶𝗰𝗲 𝗿𝗲𝗴𝗶𝘀𝘁𝗿𝘆 All microservice instances register themselves in a shared location, called a service registry. Service registry is a component that contains the list of IP address of all healthy instances of the mincroservices. When a new request arrives, API gateway reads this information from the service registry, gets the list of all available service instances and picks one particular instance to send a request to it. ⚡️𝗖𝗮𝗰𝗵𝗲 Cache is an in memory storage component, for faster accesses of frequently requested resources/APIs. Benefits: 🔹improved performance 🔹reduce latency 🔹enhanced user experience ⚡️𝗠𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲𝘀 A collection of small, independent services. Each microservice represents a self-contained unit of functionality that can be developed, deployed, and scaled independently Each service is owned and maintained by its own team. Microservices can be hosted on their own separate domain. Benefits: 🔹modularity 🔹scalability 🔹autonomy and flexibility Thanks for reading. Share your feedbacks/queries in the comments. Retweet and Follow @happydecoder
9
251
3
1,038
157,209
Virat tells you that fitness matters. Rohit tells you that fitness doesn't matter.
40
16
8
458
44,388
𝗔𝗽𝗽𝗲𝗮𝗿𝗶𝗻𝗴 𝗳𝗼𝗿 𝗮 𝘀𝘆𝘀𝘁𝗲𝗺 𝗱𝗲𝘀𝗶𝗴𝗻 𝗶𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 ? Read this 8 system design non-functional requirements. Non-Functional requirements defines qualities of a system, how a system is supposed to be. For example: scalable, highly available, fast etc
9
34
1
244
57,883
𝗥𝗘𝗤𝗨𝗘𝗦𝗧 𝗧𝗜𝗠𝗘𝗢𝗨𝗧𝗦 ⚡️ 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝗿𝗲𝗾𝘂𝗲𝘀𝘁 𝘁𝗶𝗺𝗲𝗼𝘂𝘁𝘀 ? 𝗪𝗵𝘆 𝗱𝗼 𝘆𝗼𝘂 𝗻𝗲𝗲𝗱 𝘁𝗶𝗺𝗲𝗼𝘂𝘁𝘀 ? To understand request timeouts, 𝗙𝗶𝗿𝘀𝘁, 𝗶𝘁'𝘀 𝗶𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝘆𝗼𝘂 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱 𝘁𝗵𝗲 𝘁𝘆𝗽𝗲𝘀 𝗼𝗳 𝗳𝗮𝗶𝗹𝘂𝗿𝗲𝘀. When you’re communicating between two services using an API. There can be 2 types of failures. 🔹𝗙𝗮𝘀𝘁 𝗙𝗮𝗶𝗹𝘂𝗿𝗲𝘀 🔹𝗦𝗹𝗼𝘄 𝗳𝗮𝗶𝗹𝘂𝗿𝗲𝘀 In case of a fast failure, the server instantly responds with the failure message. Example: 503 for service unavailable, 400 for some issues with your request params etc In case of a slow failure, a request that you make to the server gets stuck indefinitely in processing. It takes a lot of time to resolve. This hijacks resources on both the sides, the Client and the server. If slow failures are not resolved quickly, they can end up overusing the system resources and can lead to complete failure of the system. 𝙃𝙤𝙬 𝙩𝙤 𝙖𝙫𝙤𝙞𝙙 𝙩𝙝𝙚 𝙨𝙡𝙤𝙬 𝙛𝙖𝙞𝙡𝙪𝙧𝙚𝙨 𝙛𝙧𝙤𝙢 𝙗𝙧𝙚𝙖𝙠𝙞𝙣𝙜 𝙩𝙝𝙚 𝙨𝙮𝙨𝙩𝙚𝙢 ? You convert slow failures into fast failures, using a concept known as 𝗧𝗜𝗠𝗘𝗢𝗨𝗧𝗦. The request timeout happens when request processing takes too much time on the server side, and the client is not willing to wait any longer. Each request is initiated with a timer, when the request takes longer time to respond then the designated timer value. The request will get 𝘁𝗶𝗺𝗲𝗱-𝗼𝘂𝘁. At the end of the timer value, the client will explicitly close the request, this will free up the resources on client and the server. In case of a timed-out request the client is left with multiple options. The client can either, ◾️ retry the request ◾️ cancel the request entirely ◾️ failover the request to another instance ◾️ fallback to other means of sending the request Now, the next question is how do you pick a proper request timeout value ? Is 2 sec enough ? is 3 sec sec a good value ? Let's see. Your goal is to try to minimise the tail request latencies. A common practice is to measure the latency of the slowest requests in the system. Then pick a high percentiles (p99) of the request latency metric as your request timeout value. Thanks for reading till the end. Share your feedbacks/queries in the comment. Do retweet and follow @happydecoder
3
46
226
58,971
𝗠𝗲𝘀𝘀𝗮𝗴𝗲 𝗤𝘂𝗲𝘂𝗲 𝗩𝗦 𝗣𝘂𝗯𝗹𝗶𝘀𝗵/𝗦𝘂𝗯𝘀𝗰𝗿𝗶𝗯𝗲 📌 There are two primary asynchronous messaging models: 1️⃣ 𝗠𝗲𝘀𝘀𝗮𝗴𝗲 𝗾𝘂𝗲𝘂𝗶𝗻𝗴 2️⃣ 𝗣𝘂𝗯𝗹𝗶𝘀𝗵 𝘀𝘂𝗯𝘀𝗰𝗿𝗶𝗯𝗲 Here's a quick little visual that illustrates both of them.
6
38
237
43,896
𝗥𝗲𝘃𝗲𝗿𝘀𝗲 𝗽𝗿𝗼𝘅𝘆 𝘃𝘀 𝗔𝗣𝗜 𝗴𝗮𝘁𝗲𝘄𝗮𝘆 𝘃𝘀 𝗟𝗼𝗮𝗱 𝗯𝗮𝗹𝗮𝗻𝗰𝗲𝗿 ⚡️𝗥𝗲𝘃𝗲𝗿𝘀𝗲 𝗽𝗿𝗼𝘅𝘆 Reverse proxy is a server sitting in front of one of more application servers. It keeps original servers hidden and protects servers from malicious client requests. Use cases: 🔹Security 🔹Load balancing 🔹SSL termination 🔹Caching ⚡️𝗔𝗣𝗜 𝗴𝗮𝘁𝗲𝘄𝗮𝘆 API gateway is a specialised implementation of reverse proxy. It's a server that acts as a single entry point for all API calls from clients to your backend services. It is used to route your API request to the corresponding service instance. e.g API gateway will route your payment request to the payment service. Your authentication request to auth service etc. Use cases: 🔹Request routing 🔹API management 🔹Request/Response transformation 🔹Authorisation 🔹Rate limiting 🔹Caching, Monitoring, Logging etc. ⚡️𝗟𝗼𝗮𝗱 𝗯𝗮𝗹𝗮𝗻𝗰𝗲𝗿 Load balancer is used to distribute your incoming requests fairly among multiple instance of the same service. It ensures that no single server is overwhelmed with traffic and improves the overall availability and reliability of a system. Use cases: 🔹Traffic distribution 🔹Health checks 🔹High availability 🔹Scalability To summarise: ⚡️Use reverse proxy for security/privacy of server. ⚡️Use API gateway for centralised API management. ⚡️Use Load balancer to distribute traffic evenly. Thanks for reading. Share your feedbacks/queries in the comments. Retweet and Follow @happydecoder
20
345
6
1,388
160,640
𝗟𝗲𝗮𝗿𝗻 𝗛𝗧𝗧𝗣 𝗰𝗮𝗰𝗵𝗲 𝗹𝗶𝗸𝗲 𝘆𝗼𝘂'𝗹𝗹 𝗻𝗲𝘃𝗲𝗿 𝗳𝗼𝗿𝗴𝗲𝘁. 🧵
8
123
1
693
135,147
Learn HTTP cache like you'll never forget. 🧵
9
176
4
968
209,978
𝗜𝗱𝗲𝗺𝗽𝗼𝘁𝗲𝗻𝗰𝗲 📌 Idempotence is a property of certain operations/API. An idempotent api can be repeated an arbitrary number of times. And the result will be the same as if it had been done only once. e.g. Sorting a list is idempotent, as repeated sorting has no effect
7
23
184
36,920
𝗙𝗶𝘅𝗲𝗱 𝘄𝗶𝗻𝗱𝗼𝘄 𝗰𝗼𝘂𝗻𝘁𝗲𝗿 - one of the simplest ways to implement rate limiting. - divide the timeline into fixed-size windows - assign a counter to each window - each reqs, based on its arrive time, is mapped to a window - increment the counter on every request
1
1
7
1,311
𝗔𝗣𝗜 𝗿𝗮𝘁𝗲 𝗹𝗶𝗺𝗶𝘁𝗶𝗻𝗴 lets you limit the number of requests that a client can send to the server within a certain time interval. Once the upper limit is reached, Further requests are either queued for later processing, or straight up dropper and ignored.
1
4
9
2,236