graph LR; subgraph Students A[id name age netWorth] B[1 Ram 12 8000] C[2 Radha 14 3400] D[3 Seeta 14 300] E[4 Ramu 14 3000] end subgraph Networth X[netWorth] Y[300] Z[3000] WW[3400] W[8000] end D-->Y B-->W C-->WW E-->Z subgraph Indexing XRT[Now it is optimised <br>here a separate memory<br>is assigned] end subgraph DataStructure XRTR[B-trees structure <br>used to store indexing] end
graph LR; A("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/amazon.png'; width='80' />" Amazon)-->B("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/cart.jpeg'; width='80' />"Amazon Cart)-->C[Synchronous<br>Item in stock<br> or not during order<br>wait or block to check<br>highly consistent] D("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/amazon.png''; width='80' />" Amazon)-->E("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/pay.jpeg'; width='80' />"Order Payment)-->F[Synchronous<br>Payment<br>highly consistent] G("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/amazon.png''; width='80' />" Amazon)-->H("<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/notification.png'; width='80' />"Order Notification)-->I[ASynchronous<br>no problem if<br>we receive notification<br> with delay]
Zomato :
Kafka has high throughput
but Kafka's storage is temporary and very low
DB: throughput low ,storage high, we can query the data
graph LR; A["<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/zomato.png''; width='80' />"<br>Zomato<br>producing 1m data per seconds<br><br>Producer] B["<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/kafka.png''; width='80' />"<br>Kafka<br>Consuming the datas] A-->B--Bulk insert after<br> a fixed time-->C["<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/psql.png''; width='80' />"<br>Kafka<br>Consuming the datas] subgraph Datas B-->Speed B-->Distance B-->Time X[1 million datas] end
We will be doing partitioning in case of Kafka to manage large data because Kafka is singly here and here we can vertically scale the system so Partitioning will be here
graph LR; A["<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/zomato.png''; width='80' />"<br>Producer] subgraph Kafka Server B["<img src='https://raw.githubusercontent.com/shubham21155102/Archieve/main/System_Design/kafka.png''; width='80' />"<br> Kafka] subgraph Partition1 AX[Managing Riders Update] AXX[Managing Data For USA] AXY[Managing Data For India] AX-->AXY AX-->AXX end subgraph Partition2 AY[Managing Restaurent Updates] AYX[Managing Data For USA] AYY[Managing Data For India] AY-->AYY AY-->AYX end end A-->AX A-->AY C[Consumer 1] D[Consumer 2] AXX-->C AYX-->C AXY-->D AYY-->D C--Consistent-->D D--Consistent-->C
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers D1[D1] end A-->D1 B-->D1 C-->D1 D-->D1
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers D1[D1] D2[D2] end A-->D1 B-->D1 C-->D2 D-->D2
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers D1[D1] D2[D2] D3[D3] end A-->D1 B-->D1 C-->D2 D-->D3
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers D1[D1] D2[D2] D3[D3] D4[D4] end A-->D4 B-->D1 C-->D2 D-->D3
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers Group 1 D1[D1] D2[D2] D3[D3] D4[D4] D5[D5] end A-->D4 B-->D1 C-->D2 D-->D3 subgraph Consumers Group 2 D11[D1] D21[D2] end A-->D11 B-->D11 C-->D21 D-->D21
graph TD; A[Kafka as a] B[Queue] C[PUB/SUB] A-->B A-->C B-->D[When No. of <br> Consumers==Producers] C-->E[When No. of <br> Consumers!=Producers]
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers D1[D1] D2[D2] D3[D3] D4[D4] end A-->D4 B-->D1 C-->D2 D-->D3 subgraph Behaviour T[Here Kafka will act as Queue] end
graph LR; subgraph Consumer Groups; subgraph Topic A[P1] B[P2] C[P3] D[P4] end end subgraph Consumers Group 1 D1[D1] D2[D2] D3[D3] D4[D4] D5[D5] end A-->D4 B-->D1 C-->D2 D-->D3 subgraph Consumers Group 2 D11[D1] D21[D2] end A-->D11 B-->D11 C-->D21 D-->D21 subgraph Behaviour T[Here Kafka will act as PUB/SUB] end