6. Consistent Hashing in Hindi with Example | System Design - Consistent Hashing | High Level design

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ก.ย. 2022
  • Consistent Hashing is a distributed hashing scheme that operates independently of the number of servers or objects in a distributed hash table by assigning them a position on an abstract circle, or hash ring. This allows servers and objects to scale without affecting the overall system.
    So main purpose is to distribute the load among the servers equally and during addition or deletion of server, minimum number of keys to be rebalanced.
    prerequisite: • 5. Scale from ZERO to ...
    Join this channel to get access to perks:
    / @conceptandcoding
    Telegram group: t.me/+KwJhmit5yDczNzY1
    #consistenthashing #loadbalancing #systemdesign

ความคิดเห็น • 103

  • @uraveendra
    @uraveendra 2 หลายเดือนก่อน +3

    have refered many videos on consistent hashing but this video cleared all my doubts and crisp and clear content, well narrated 👏

    • @ConceptandCoding
      @ConceptandCoding  2 หลายเดือนก่อน

      thanks

    • @uraveendra
      @uraveendra 2 หลายเดือนก่อน

      @@ConceptandCoding I have a rudimentary question here. Consistent hashing will be used for scaling up and scaling down systems right ? for any unexpected server fail over, we need to relay the redundant systems running at separate server/cluster right ?

  • @nabajyotimajumdar4511
    @nabajyotimajumdar4511 หลายเดือนก่อน +1

    best video on consistent hashing

  • @suchitrasrinivas4330
    @suchitrasrinivas4330 ปีที่แล้ว +3

    Thanks for making consistent hashing so easy to understand, especially where you explain about Virtual Nodes.👍👍

  • @BrijeshYadav-xu5kj
    @BrijeshYadav-xu5kj ปีที่แล้ว +1

    Recently i started watching your videos, they are very helpful, thanks for making these videos ,

  • @chillaxabhinav
    @chillaxabhinav หลายเดือนก่อน +1

    Easy to understand, Thanks

  • @JavaWithAFlow
    @JavaWithAFlow 19 วันที่ผ่านมา +1

    Thanks, for this crisp explanation . I

  • @KumarSahil78
    @KumarSahil78 ปีที่แล้ว +7

    First time watching you, and it's really great experience, your way to teaching is just incredible 🔥.

  • @sagarbiradar1104
    @sagarbiradar1104 ปีที่แล้ว +1

    Very very Clear explanation🔥🔥

  • @SatyamKumar-bw4vi
    @SatyamKumar-bw4vi 8 หลายเดือนก่อน +4

    Hare Krishna..! Bhaiye
    Great work

  • @rahulsharma15
    @rahulsharma15 ปีที่แล้ว +1

    Thanks for your efforts buddy.keep up the good up work like these.

  • @ankitsh6557
    @ankitsh6557 ปีที่แล้ว +8

    In case of virtual objects, when a server is taken down. All the associated virtual objects will also be removed from the ring. In this case the rebalancing will be high.

    • @AmitSharma-yb9vc
      @AmitSharma-yb9vc ปีที่แล้ว

      Actually, not; if there are n keys and m servers, then on average n/m keys are associated with the server; and virtual server help to go close to this average in uneven distribution.

    • @LegitGamer2345
      @LegitGamer2345 5 หลายเดือนก่อน

      When the main server is taken down we can choose some virtual server as the main one based on some algorithm since the virtual server is a replica of the main server, what do u guys think?

    • @girishanker3796
      @girishanker3796 10 วันที่ผ่านมา

      The virtual servers are taken out from different locations in the ring. The concept of consistent hashing with virtual servers is to distribute even load to all the servers.

  • @yashsingh3819
    @yashsingh3819 ปีที่แล้ว

    aapki videos bohot helpful rehti h. accenture innovation chalenge pr bhi ek video bana dijiye please. Hame thodi help ho jaegi

  • @prakharjalan7546
    @prakharjalan7546 9 หลายเดือนก่อน

    Will we be able to just rebalance 1/n keys even if a server which is replicated thrice goes down?(In virtual objects) and what if the number of servers exceeds the size of the virtual ring?

  • @___vandanagupta___
    @___vandanagupta___ ปีที่แล้ว +1

    Great explanation sir!! Keep up the good work!!!

  • @Tanzim-ho7nf
    @Tanzim-ho7nf วันที่ผ่านมา +1

    Owo❤. Thanks 👍

  • @ayush_singh6203
    @ayush_singh6203 ปีที่แล้ว +2

    Amazing content, crystal clear explanation.

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว

      Thanks

    • @ayush_singh6203
      @ayush_singh6203 ปีที่แล้ว

      @@ConceptandCoding One small question,
      I too have an iPad but looking for good tool to make notes and diagrams. Could you tell which software you used in this video to present these diagrams.

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว

      @@ayush_singh6203 one note

  • @1997uday
    @1997uday 9 หลายเดือนก่อน +3

    I have a question, we are figuring out the initial placement (lets say each DB server) using a hash function. After that, we place the replica of those db servers (virtual servers) to balance the storage of any keys (data). Now, if we get a read request, even after doing a hash (and mod) of it, we will have to know the locations where the virtual servers are placed as well to know which server that read request should be mapped to. Will we store the mapping of virtual db server and its location somewhere?

    • @meetakbari9897
      @meetakbari9897 หลายเดือนก่อน

      I think the mapping of virtual db and its location can be stored in a centralized metadata store, such as a distributed key-value store or a metadata database. So when a read request comes in, you would first hash the key to determine the initial server where the data is located. Then, you would consult the mapping of virtual db to identify the actual db where the data replica resides. Finally, you route the read request to that server to fetch the data.

  • @anonymous34565
    @anonymous34565 ปีที่แล้ว +2

    Great explanation.
    Pls also make some mock interview on machine coding round.

  • @nikiteshnandale8264
    @nikiteshnandale8264 11 หลายเดือนก่อน +4

    instead of randomly assigning positions, we can implement an algorithm, which will assign positions to all the servers , such that all the servers will be equidistant from each other. If all servers will be equidistant from each other Like they were in the early examples of Consistent hashing, then I think our purpose of implementing consistent hashing will be fulfilled.
    feedbacks are welcomed

    • @ConceptandCoding
      @ConceptandCoding  11 หลายเดือนก่อน +1

      Right

    • @KumarSaurabh-nu9cr
      @KumarSaurabh-nu9cr 4 หลายเดือนก่อน

      If you plan to keep all the servers equidistant from each other, then an addition or a removal of a server will lead to movement of servers on the ring which would lead to more rebalancing. No?

    • @Nerddog12344
      @Nerddog12344 2 หลายเดือนก่อน

      ​@KumarSaurabh-nu9cr Correct

  • @RahulPatel-lq6qp
    @RahulPatel-lq6qp หลายเดือนก่อน

    would like to see live demo of this to understand it better

  • @collab_with_tushar_raj
    @collab_with_tushar_raj 5 หลายเดือนก่อน

    @ConceptandCoding Thank you for touching upon the "servers being equidistant" and "servers being next to each other" parts in the ring. I have a very lame question. When we create virtual servers, to solve the issue with the servers being next to each other, is there any logic we follow, like a math function that generates random points in the circle? How do we know that we have achieved 1/n% of rebalancing in this case? Can you give one small use case where we can understand how to calculate the 1/n% of rebalancing after creating virtual points?
    Like I said, apologies for my lame question. I would really appreciate it if you cleared this doubt. Thank you in advance!

  • @mehulparmar9976
    @mehulparmar9976 ปีที่แล้ว

    If hashing function provided to partition key makes node assigned random. Then why it is advised to choose a partition key as random as possible

  • @chessfolks3827
    @chessfolks3827 ปีที่แล้ว

    Absolutely worth it. Can you also share the reference or book where you prepare the material?

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      Generally i read, "Design data intensive application"
      But this topic i read from DynamoDB research paper, as DynamoDB also uses Consistent Hashing, so they explained it in detailed.

  • @bishwajeetbasudevdas3157
    @bishwajeetbasudevdas3157 6 หลายเดือนก่อน +1

    Nice explanation

  • @rv0_0
    @rv0_0 3 หลายเดือนก่อน

    I joined membership yet i am not able to access this content. Please help.

  • @gurupreetsingh8347
    @gurupreetsingh8347 7 หลายเดือนก่อน

    when we talk about to replicate the servers of virtual objects , are they actual physical replication of machine or just virtual replication ? and whatever it is but how we come up with the location on the Ring to replicate them ?(virtual object) because we already used mod hashing to place the actual servers on the ring, and what about hash colison while calcuating hash values for Servers, ? two or more servers can have same hash-code so how to handle it!!?

    • @DeepakYadav-fh9tz
      @DeepakYadav-fh9tz 18 วันที่ผ่านมา

      Really good questions, But since I have seen consistent hashing at multiple places here are the answers:
      1. It is just a virtual replication not the actual replication. We could do it by having multiple hash functions per server. The hashing functions should be in a way that satisfies the properties of keeping them in a ring.
      2. hash collisions interesting point, but since we are just assigning the load, suppose k1 and kn colloide they simply move to the same server.

  • @nikhilkumar-jy6mz
    @nikhilkumar-jy6mz หลายเดือนก่อน

    For HLD interview do they ask us to write the code or just to explain the concepts ? because I never saw any youtuber explaining using code

    • @ConceptandCoding
      @ConceptandCoding  หลายเดือนก่อน

      foe HLD no coding is required only concepts and for LLD you need coding

  • @ankitgupta-ph4nk
    @ankitgupta-ph4nk 11 หลายเดือนก่อน +1

    Great Explanation🎉

  • @priyadarshinir9730
    @priyadarshinir9730 ปีที่แล้ว

    Great Explanation!
    i have few doubts...
    let's say a key is requested repeatedly and that key lies is one of the replica's, so request goes to the same replica everytime.
    how's consistent hashing helping here?
    aren't we putting heavy load on the same replica every time?
    how's the traffic equally distributed in this case?

    • @amituchat4865
      @amituchat4865 ปีที่แล้ว

      (1) A consistent hashing helps even distribution of unique keys across all servers.
      (2) A single key request is designed to hit one unique server where the value resides, so if one request arrives repeately for million times then by design it should hit the same server million times.
      (3) Bigger question is what situation made this usecase possible? and
      (4) Do you think caching those request/respose could help in this usecase?

    • @piyushtale0001
      @piyushtale0001 9 หลายเดือนก่อน

      @@amituchat4865 Or we can add a Rate Limiter

  • @ishaankaustav727
    @ishaankaustav727 10 หลายเดือนก่อน

    how are we deciding the size of queue in virtual ring ?
    suppose we have flood of request with key (k1) , in this case all request will go at server 1 only , so how does consistent hashing is solving the problem ?

    • @ConceptandCoding
      @ConceptandCoding  10 หลายเดือนก่อน

      Ack of the question

    • @harshagarwal_net
      @harshagarwal_net 5 หลายเดือนก่อน +1

      that means your hash function is not proper. or may be you not choose right colume for hashing. because even distribution is responsibility of hash function.

  • @anjumanislamiachhatarpur7093
    @anjumanislamiachhatarpur7093 ปีที่แล้ว

    In our example we have taken the virtual ring size of 12, but how do we decide that number? Is it the maximum number of nodes possible we assumed?
    Could you please tell us.

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว

      It's just a example i took may be in reality for big companies it might be in 100a or thousands

    • @anjumanislamiachhatarpur7093
      @anjumanislamiachhatarpur7093 ปีที่แล้ว

      @@ConceptandCoding thank you so much 🙏

  • @piyushmathpal4244
    @piyushmathpal4244 ปีที่แล้ว

    We are designing insta and sharding(horizontally) based on USERID, definitely we will fall into the problem of hot users and ovio shard will grow big as ronaldo posts a lot.
    How do we handle such case ?
    Note: Sharding by POSTID is very oldschool. Querying db for getting ALL post of a user will be an expensive operation which seems one of a primary ask from our system, here.

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      Thats why Consistent Hashing technique is used, as sharding by postid is old-school :)
      Whatever problem you have mentioned it can be resolved using consistent Hashing itself.

    • @piyushmathpal4244
      @piyushmathpal4244 ปีที่แล้ว

      @@ConceptandCoding Can you please elaborate how?
      Sharding based on userID will put one of the hot users in a single shard. If that goes down, user's data goes down. How does consistent hashing solves our issue here? It will be used to allocate a userID to a specific server only. Correct me if I'm wrong. Even if we have virtual replicas, still user data will go to a single shard. How do we develop a robust solution here?

    • @rupeshjha4717
      @rupeshjha4717 ปีที่แล้ว +1

      @@piyushmathpal4244 i think the hash key of diff post id wont go to the same server, it will be distributed over circle and can be handled accordingly by diff nodes

  • @logicalrisi
    @logicalrisi 3 หลายเดือนก่อน

    thanks....bhai notes bhi dediya kro

  • @himanshukaushal8375
    @himanshukaushal8375 ปีที่แล้ว

    If we have 100 keys and 5 nodes then how many rebalancing nodes are needed in total? I didn't understood that point.

  • @biggbali
    @biggbali ปีที่แล้ว

    How to know total no. of keys ?

  • @FazilKhan-vr6sw
    @FazilKhan-vr6sw ปีที่แล้ว

    Hi, what would happen of the no if servers reached to the size of virtual ring .?

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      Hi Fazil, as per my understanding, the hash space(total no of nodes it can have) for Consistent hashing is Huge (generally in 2^256) so scale up issue do not come here.

    • @FazilKhan-vr6sw
      @FazilKhan-vr6sw ปีที่แล้ว

      @@ConceptandCoding Thanks a lot for clarifying.

  • @amitbansal7754
    @amitbansal7754 17 วันที่ผ่านมา

    Bhai 1 raise to n nahi 1 by n number hoga vo

  • @mayursamnani8964
    @mayursamnani8964 25 วันที่ผ่านมา

    What does hashing the server signify at 18:48?

    • @girishanker3796
      @girishanker3796 10 วันที่ผ่านมา

      Passing the name or ip address of the sever through a hash function

  • @sushil1922
    @sushil1922 11 หลายเดือนก่อน

    Suppose S3 is getting request of 90 keys. Then if we remove s3. Then all the requests going to s3 needs rebalancing similar to normal hashing. Isn’t it?

    • @sushil1922
      @sushil1922 11 หลายเดือนก่อน

      Only benefit of consistent hashing is even distribution at particular time using virtual locations of every servers? And not rebalancing ?

  • @subhamacharya4472
    @subhamacharya4472 ปีที่แล้ว +1

    Why we are taking 12 sectors in the virtual ring ?

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      Hi Shubham, i just took an example, generally its a large number not 12.

    • @subhamacharya4472
      @subhamacharya4472 ปีที่แล้ว

      @@ConceptandCoding how to decide, how many we need to consider for the virtual ring?

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      @@subhamacharya4472 Shubham it depend upon the company needs.

    • @dipanshumewara6116
      @dipanshumewara6116 ปีที่แล้ว

      And how can you decide ring sectors as requests can be in millions and ever increasing

  • @gopichinthagumpula6481
    @gopichinthagumpula6481 ปีที่แล้ว

    What if I don't know hindi.. And want to learn the content you are creating

    • @amituchat4865
      @amituchat4865 ปีที่แล้ว

      Subtitles??

    • @irbansin
      @irbansin 8 หลายเดือนก่อน

      There are courses in other languages too. If there is none, create one. It will increase diversity of that language

  • @KumarSaurabh-nu9cr
    @KumarSaurabh-nu9cr 4 หลายเดือนก่อน

    1 raise to power n keys nhi ho rha rebalance.. Please yaar, jo likh rhe ho woh toh bolo kam se kam

  • @TsarVladolfPutler
    @TsarVladolfPutler 4 หลายเดือนก่อน +1

    Comrade Shreyansh, you have been drafted. Report to your nearest conscription office where you will be tasked with building scalable military-grade systems which would be invulnerable to Ukrainian and NATO cyberattacks

    • @Ashish-ty5rb
      @Ashish-ty5rb 4 หลายเดือนก่อน

      Military mainly uses real time systems I don't think scaling them largely is super important untill unless you are trying to take over whole world at once 💀💀

  • @ajaysabarish9645
    @ajaysabarish9645 ปีที่แล้ว +1

    Please speak in english or atleast add english subtitles

    • @ConceptandCoding
      @ConceptandCoding  ปีที่แล้ว +1

      Hi Ajay, i used mixed language, it would be easily understand

    • @ajaysabarish9645
      @ajaysabarish9645 ปีที่แล้ว

      @@ConceptandCodingAs a non hindi person, any Hindi word goes above my head,making it impossible to comphrehend the lecture. Can you please at least add english subtitles ?

    • @amituchat4865
      @amituchat4865 ปีที่แล้ว

      @@ajaysabarish9645 I understand your concern, if you do not have option like subtitles etc then just listen attentively, most hindi words used are filler words (one time learning, by making a list) but the key words vocab are always english. In the quest of making hindi words list, you will end up listening attentively and hopefully get a crystal clear understanding of a topic as a biproduct. Hope it helps

  • @shwetankgupta07
    @shwetankgupta07 ปีที่แล้ว

    Not able to join telegram group via given link. Please help @Concepts && Coding

  • @mridul1075
    @mridul1075 9 หลายเดือนก่อน

    Bhaiya hld ka members only free krdo 🥲

  • @shankysays
    @shankysays 3 หลายเดือนก่อน

    Hi shrayansh, i needed some preparation guidance from you. Can i connect to you over LinkedIn or Facebook whichever is comfortable for you?

    • @ConceptandCoding
      @ConceptandCoding  3 หลายเดือนก่อน

      yes linkedin i am good.

    • @shankysays
      @shankysays 3 หลายเดือนก่อน

      I sent you connect request. Please accept it so that i can message and get some valuable guidance from you. My name is shashank Kumar

    • @shankysays
      @shankysays 3 หลายเดือนก่อน

      My name is shashank Kumar

  • @lakshyachhabra7837510764
    @lakshyachhabra7837510764 ปีที่แล้ว

    Hi i have one doubt so let’s suppose if two servers not replicas point to same hash key which means let’s suppose you have 3 servers and 2 of them points to same hash id which means 2
    Then how and which server will take that request??

    • @ayush_singh6203
      @ayush_singh6203 ปีที่แล้ว +1

      You are saying two servers will have same hash key, in general this should not happen, because we always try to handle hash collision in these designs.
      But still there are some chances that servers can have same I'd, in this case you can consider other parameters to route the request like priority, session count, etc. (Depends on the use case, but this is very very rare)