Key based Sharding | Shard Key | Hash function | Advantages and disadvantages | 2021

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 58

  • @roshedulalamraju7936
    @roshedulalamraju7936 Год назад

    Watched lot of videos but your one is the best. Love you. Thanks.

  • @akshayshah8264
    @akshayshah8264 3 года назад

    A concise and to the point video. Thank you

  • @vijaysharma5679
    @vijaysharma5679 3 года назад +1

    Hi Yogita, Your videos are very helpful for understanding system design concepts throughly. Can you please make some videos on Cassandra and Hbase too? More specifically on Data Modeling, and using some existing system designs examples of where can we use MySql, Cassandra, and Hbase.
    Thanks for your wonderful contribution to our preparation.

  • @thecloudbaba8668
    @thecloudbaba8668 5 месяцев назад

    wonderful @sudoCode chossing a right Sharding key or combinations is crucial and needs advised an deep decisions ... kudos to you!

  • @sreenivasnaidu6904
    @sreenivasnaidu6904 2 года назад

    simple and very informative

  • @TheDiscreet
    @TheDiscreet 3 года назад

    Very good introduction to sharding... How is replication taken care of in case of sharded DB servers.. How is it made fault tolerant..

  • @basawarajshivashetty5232
    @basawarajshivashetty5232 3 года назад

    It's great source to learn system designing..mam can you please make videos on interview design questions

  • @UECAshutoshKumar
    @UECAshutoshKumar 2 месяца назад +1

    Thank you 👍

  • @HamidAli-gy4um
    @HamidAli-gy4um 3 года назад

    It is very Informative Thank you

  • @TheANKUSHVIDEOYOUTUB
    @TheANKUSHVIDEOYOUTUB 3 года назад

    Good to have very informative and clear understanding video from Indian
    Keep it up and wish for your great journey 🙏

  • @hi2ritesh
    @hi2ritesh 3 года назад +1

    very informative Yogita, thank you for making this video. One question what will happen if we have to move multiple tables into different physical sharding? in that case fetching the data requires to contact multiple shards, right?

  • @ekoprasetyooo
    @ekoprasetyooo Год назад

    thanks for the video. I have a question, what the different with partition key? looks like same ya for the function after all. Thanks

  • @eros_1234
    @eros_1234 3 года назад +1

    Nice lecture Mam😇😇
    Keep it up.✌✌

  • @rupeshjha4717
    @rupeshjha4717 3 года назад

    Short, clear, and easy to understand!!
    Ma'am when we will use the city as shard-key then let's say a user is in berlin on 20 Feb 2021 and now on 24th Feb 2021 he moved to Banglore, so in that case how the situation would be handled because earlier the write operating was going to key = Hash(berlin) shard but now the key will be changed as key = Hash(Banglore). So if that user sends a read or write operation then the data is not there in the shard having Key = Hash(Banglore) ??

    • @sudocode
      @sudocode  3 года назад +1

      Exactly, that's why in key based sharding we choose keys which are static and don;t change frequently. If a user's city is changing frequently then we don't choose that as sharding key

  • @fadedmemes
    @fadedmemes 4 месяца назад

    Rather than moving data to shard three cant we modify hash function in such a way that every write operation will store to shard three?

  • @SakshiSingh-arcane05
    @SakshiSingh-arcane05 Год назад

    very informative yogita, thanks a lot!
    I have a question, say Tinder supports location based sharding although if I go to another city, I will have to be immediately added to that DB, and if we consider multiple such movements, how would tinder handle such dynamic changes?

  • @vazzdoin
    @vazzdoin Год назад

    good work..

  • @neha6000
    @neha6000 Год назад

    Thank for nicely explanation

  • @kunalsoni7681
    @kunalsoni7681 3 года назад

    Wow it's so informative video 😊

    • @sudocode
      @sudocode  3 года назад +1

      Thanks a lot 😊

  • @deepakjiitn
    @deepakjiitn 7 месяцев назад

    One disadvantage is that in such sharing range queries can’t be performed. For example list top 10 employees based on their salary.

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 года назад +1

    Thanks a lot for such a detailed and informative video. Request you to upload some video on full system design on UBER, FACEBOOK or any other system so that we can apply all the concepts that we have learnt into one system. Thanks a lot for your time and hard work. Truly appreciate your dedication. Kind regards.

    • @sudocode
      @sudocode  3 года назад

      Yes, will upload. :)

  • @sundaramjha1776
    @sundaramjha1776 3 года назад

    Please if u can create a video on how we do mysql sharding from scratch by practical example. Appreciate ur effort. Great video content. Keep continue 👍

    • @sudocode
      @sudocode  3 года назад +1

      Noted. It is in pipeline.

  • @sunilkj8281
    @sunilkj8281 2 года назад

    Hi Yogita, thanks for the video, very nicely explained. One doubt...
    Since the records are distributed in shards based on the sharding key(say city), how will each shard have equal number of records?

    • @answerme4147
      @answerme4147 2 года назад +2

      In case of city Name as a sharding key, There is not any guarantee of equal no. of records in each shard,

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 3 года назад +1

    Also please cover topics such as :
    - Consistent Hashing
    - Quad Tree
    - Web Socket , HTTP and LONG POLLING over HTTPS
    - REDIS CACHE
    - CASSABDRA
    Thanks

    • @sudocode
      @sudocode  3 года назад +1

      All of them are pipeline!

    • @brajkishoredubey9319
      @brajkishoredubey9319 2 года назад

      @@sudocode any update ? I am specifically looking for consistent hashing

  • @swaroopas5207
    @swaroopas5207 3 года назад

    Nice Video. Suppose we have 2 tables in the database. Should both the tables be sharded if we go for sharding? If so how can we derive the sharding key in multiple tables cases?

    • @sudocode
      @sudocode  3 года назад

      Depends on table sizes. Both shall have different sharding keys depending on the use case.

  • @shrikantkhadilkar4019
    @shrikantkhadilkar4019 2 года назад

    Quick question: For systems like Netflix - if we choose a sharding key based on the city and the user is travelling to a different city - how does the system handle this? What are the strategues that we could use?

    • @sudocode
      @sudocode  2 года назад

      Mostly they key won’t be chosen as per city. Key is chosen in a way such that data can be equally distributed. In case of Netflix data could be divided on the basis of categories, origin country or even alphabetically or creation date ranges etc.

  • @TheDiscreet
    @TheDiscreet 3 года назад

    I have a confusion on where load balancer for DB servers come into picture if DB is sharded.. I am not able to visualize Load balancer + sharding DB servers.. DB sharding is done to distribute data.. then we would have different DB servers.. but load balancer cannot send request based on the load to any of the sharded DB server instances? Kindly shed some light on this

  • @JPN-bx3yd
    @JPN-bx3yd 2 года назад

    How do you handle changes in shard key? For instance, the record is stored in DB1. What will happen if the shard key changes for the record and say the hash function will return DB2? The hash function will return a different database and the record will not exist there. How do you handle this scenario?

    • @FoodpediaIndia
      @FoodpediaIndia 2 года назад

      Usually you don’t change shrad key much often. Let’s say you having shrad key on City Coulmn and persons are mapped to shards based on the city. Let’s say a person living in Newyork mapped to shrad 1 and he later moved to SFO, in this scenario, any read or write request will be passing through partition awared load balancer , which would first calculate the hash of that shrad 🔑 which is 1, and write updates the city column which is now SFO. Now any CDC I.e Change of Data Change will detect and reshrad this key to shard 2 ( SFO) associated and remember this shrad 2 may be replicated for better throughout so, we need to make sure we created this entry in all replicas.

  • @babitanewbaby
    @babitanewbaby 3 года назад

    Is the right shard key _id :hashed ? If not explain what is the reason

  • @AshishShukla-ro8oy
    @AshishShukla-ro8oy 3 года назад

    weather it can be the case that out data is not equally distributed among all the shard's and there is large load on one of the shard's....weather there is a way to over come this? sorry if my ques is bogus...

  • @streammxc
    @streammxc 3 года назад

    Nice video! One question here, I am kind of wondering how to query on the sharded database? Will the query run on each of them?

    • @sudocode
      @sudocode  3 года назад

      Nope, the algorithmic sharding logic will take care of routing the query. This is one of the advantages of sharding that the read and write query performance increases a lot since these queries run only on relevant shard and not the whole data.

    • @streammxc
      @streammxc 3 года назад

      ​@@sudocode If the shard key is user's first name, but the query selecting all the users that have the same last name, for example, Smith. In that case, it has to query through all the shards, is that correct?

    • @kunal_tanti
      @kunal_tanti 3 года назад +1

      @@streammxc Yes, in that case you have to send the query to all the shards and aggregate the result. That is called scatter and gather.
      And this is one bottleneck in key based sharding.. any non key based read query will not be efficient.

  • @priyankataneja7347
    @priyankataneja7347 2 года назад

    In this Key based Sharding we are first running the hash function on userId and based on the response we are adding data to Shards? In that case if I have 5000 rows I need to run hash function on 5000 userIds and then decide in which shard it should store?

  • @ravikumar-yq5df
    @ravikumar-yq5df 3 года назад

    Please also consider implementing these concepts

  • @mohitagrawal1555
    @mohitagrawal1555 Год назад

    suppose the data is shared with location as key and now i want to fetch the information using the user Id and dont know the location. So, how could i find out in which shard the user with given user id exit ??

    • @abhinavjaglan1782
      @abhinavjaglan1782 10 месяцев назад

      need to aggregate all the shards data and then do a filter on them

  • @babitanewbaby
    @babitanewbaby 3 года назад

    I am not understand how to shard key choose, briefly explain in the comment box

  • @sumonmal009
    @sumonmal009 3 года назад +1

    shard key 1:15
    hash shard is known as algorithmic sharding 2:00
    disadvantage hash shard 4:50
    to solve the hash shard problem use consistent hashing

  • @mukeshbisht2411
    @mukeshbisht2411 2 года назад

    apart from good content, nice decorated heading is awesome:-)

  • @ajaypathak8107
    @ajaypathak8107 3 года назад

    👍

  • @OthmaneLAHRIMI
    @OthmaneLAHRIMI 7 дней назад

    Thank you 🌹

  • @subee128
    @subee128 4 месяца назад

    Thank you very much