what is OPTIMISTIC LOCK?

Поділитися
Вставка
  • Опубліковано 15 лис 2024

КОМЕНТАРІ • 63

  • @RussianCyclop
    @RussianCyclop Рік тому

    Great explanation, thank you sir.

  • @srikanthrachala
    @srikanthrachala 4 роки тому

    Very nice and detailed explanation !!. Thank you

  • @jksharma7
    @jksharma7 5 років тому +1

    my friend you are so GREAT !!

  • @80kg
    @80kg 2 роки тому

    great content thank you sir

  • @PratikPatel-fg9xe
    @PratikPatel-fg9xe 2 роки тому

    Great explanation 👍

  • @rettipatti
    @rettipatti 2 роки тому

    Good explanation!

  • @kaushikmitra1982
    @kaushikmitra1982 Рік тому

    Nice video!!!

  • @adanarreola272
    @adanarreola272 3 роки тому

    Very well explained!

  • @ypucandeleteit
    @ypucandeleteit 3 роки тому

    awesome explanation. I will save this video for the next time I need to check this out. The rule of thumb is a lifesaver as well

  • @mallikarijit
    @mallikarijit 5 років тому +2

    Thanks, Narendra! Your tutorials have always been good.

  • @CodingWorldWithNinja
    @CodingWorldWithNinja 3 роки тому

    thanks Narendra i helps a lot me to understand locks on DB

  • @sharatchandra9198
    @sharatchandra9198 3 роки тому

    very clear and concise

  • @logicboard7746
    @logicboard7746 2 роки тому

    clear like water! thanks bro!

  • @truongquochung4858
    @truongquochung4858 3 роки тому

    What an excellent video! You explaination is very perspicuous and examples are very practicle. Keep going! 😉

  • @NaturalPro100
    @NaturalPro100 5 років тому +1

    Amazing explanation.Thanks :)

  • @adamhughes9938
    @adamhughes9938 4 роки тому

    Great as usual

  • @агатакристи-г3ы
    @агатакристи-г3ы 5 років тому +4

    Interesting and clear as usual! Thank you, Narendra!

  • @shivendrakadam7596
    @shivendrakadam7596 5 років тому

    Awesome!!! Please keep uploading videos. They are helping a lot...!!!!:)

    • @connect2rajib
      @connect2rajib 5 років тому

      Yah right.u r doing a fantastic job for free.plz keep it up. We r really grateful......its really helps.sharing is caring.

  • @thiwanka.w92
    @thiwanka.w92 3 роки тому

    Interesting

  • @soufianeodf9125
    @soufianeodf9125 3 роки тому

    good content

  • @postman12
    @postman12 3 роки тому

    thumbs up

  • @ravikiranbcm
    @ravikiranbcm 2 роки тому

    nice

  • @sayantanray9595
    @sayantanray9595 4 роки тому

    Nice explanation

  • @atexnik
    @atexnik 5 років тому

    Clear explanation! Thanks.

  • @TamilTV2
    @TamilTV2 8 місяців тому +1

    8.40 Rq 1 finishes last, Rq 2 finishes first ... how to find the latest data? will it not be wrong to change 17 to 14?

  • @fairytalesnew
    @fairytalesnew 4 роки тому +4

    Hi sir i have seen one of your video related to transactions(WAL) can you create one video which can explain the relation between the locks used by transactions and optimistic and pessimistic locks(actual question is why we need these optimistic and pessimistic locking if we already have transaction isolation levels)

  • @priyankawagh5217
    @priyankawagh5217 4 роки тому

    Thanks!

  • @PANKAJSINGH-lv7iu
    @PANKAJSINGH-lv7iu 3 роки тому +1

    If an optimistrick exception is raised then what we do. Can we write some sort of retry logic for the same transaction ??

  • @sanatandharmu
    @sanatandharmu 4 роки тому

    Please use a good sound recording device, the sound is suppressed with lot of noise.

  • @abhishekkumar9812
    @abhishekkumar9812 4 роки тому +1

    Hi Narendra, thank you very much Narendra. These videos are really helpful.
    Could please make some video on System design of paytm or phonePe or googlePay ? it would be a great help to many of us .

  • @marriagedance8657
    @marriagedance8657 5 років тому +5

    Why optimistic is even termed as a lock?

  • @mr-engineer
    @mr-engineer 5 років тому

    Awesome! Thanks for a really clear explanation.

  • @at_tap
    @at_tap 5 років тому +2

    optimistic or pessimistic locks are application level decision, so saying that pessimistic locks are for RDBMS is not right. You can pessimistic locks implemented in NoSQL DB, same ways optimistic in RDBMS.

  • @rohanbundelkhandi3202
    @rohanbundelkhandi3202 4 роки тому +2

    Please make video on: System Design of Version Control System like git

  • @amanshivhare5592
    @amanshivhare5592 3 роки тому

    When there are very few clahes, how optimistic lock is more useful, wouldn't pessimistic be useful? As no-other can edit but read, as there are less clashes, there will be no one updating so we can lock. ? I am bit confused.

  • @abhijitprusty
    @abhijitprusty 4 роки тому

    How to handle conflicts in case of optimistic locks ?

  • @satishgarepalli5977
    @satishgarepalli5977 4 роки тому

    could please explain what is a live lock mean??

  • @SteelersRock1190
    @SteelersRock1190 4 роки тому +2

    Aren't the concepts really more of "Pessimistic locking" and "Optimistic concurrency"? I've never heard it referred to as Optimistic locking since the whole point is that it's not locking but rather validating that the mutation is still safe based on criteria like versioning.

    • @amitk6701
      @amitk6701 4 роки тому +1

      Well, my first reaction here was "its lock, not control whether pessimistic or optimistic" but as more I explored, yeah this is the case - "Pessimistic locking" and "Optimistic concurrency (control mechanism with versioning, if you will)". Yep!

  • @niloysaha3229
    @niloysaha3229 5 років тому +1

    Question : How optimistic lock handles concurrency? If multiple threads are trying to update against a same version number then how the correctness of the system will retain?

    • @TechDummiesNarendraL
      @TechDummiesNarendraL  5 років тому +3

      You will need to use pessimistic lock/ transaction there. Because you are reading n updating.

    • @varunvats32
      @varunvats32 5 років тому +4

      Apart from pessimistic locking way, this can be achieved by optimistic locking also, you can read about MVCC. Many DBs like Postgress uses this approach.

    • @SteelersRock1190
      @SteelersRock1190 4 роки тому

      My team generally handles it with some sort of retry policy wrapping the processes which also enforce some basic validations. If the update fails since some other process concurrently updated the record, then you need to re-read the record and then if the update is no longer safe, it should be enforced by the common set of validations that each process would have had to enforce.

  • @boteliu6498
    @boteliu6498 4 роки тому

    So optimistic lock also need a lock before verifying version and updating data, but lock period is shorter, right?

  • @viputdBeast
    @viputdBeast 4 роки тому

    When we use frameworks like rails and start a transaction, like ActiveRecord::Base.transaction should it not acquire locks by default on the affected rows.?
    My question why transactions and acquiring locks cant go hand in hand ?

    • @natewallis1
      @natewallis1 11 місяців тому

      Surely it depends on your use case (which he explains in the video). You can get locks on anything, but should you? What impact will that have on your users?

  • @MaxPicAxe
    @MaxPicAxe 3 роки тому

    But with optimistic lock you still have to perform an atomic read and write (read version to check, and then update version and write new data within same transaction). So I don't understand the point. Am I misunderstanding something?
    Edit: Oh I see, you only acquire the lock when you are done processing the new data that should be written. I would have thought that's how people always did it.

  • @pramodrawat9113
    @pramodrawat9113 5 років тому

    how to handle OPTIMISTIC LOCKING with shading and clusters ?

  • @mohammedamenuddin3675
    @mohammedamenuddin3675 4 роки тому

    Very clear . Thanks . Does pessimistic lock require version and timestamp . If yes then why

    • @darksteam999
      @darksteam999 11 місяців тому

      No, because the editing thread will lock that record and the other thread that is trying to edit it as well will get blocked.
      The optimistic locking requires a version (or timestamp) to do the rollback of that active transaction

  • @charliezhang807
    @charliezhang807 4 роки тому +2

    Thanks for the video. One question: assuming version 1 data is n, process 1(want to +1) and 2 (want to +2) both validate that it is safe to write since version has not changed, the slow writer will operate on stale data(since the fast writer finishes writing first). How do optimistic locking solve this issue?

    • @rufusli7056
      @rufusli7056 4 роки тому +6

      Charlie Zhang Both processes will read the data at version 1, write the new value into their own write buffer in parallel. However at commit stage, one of the processes will succeed in updating the data, which will be the version after the commit. and another process will be aborted because it read data at version 1 which does not match version at commit time and have to retry its transaction

  • @ariellyrycs
    @ariellyrycs 4 роки тому +1

    I @tech Dummies, i'm a front-end developer, i got a look question in my system design and i wasn't able to answer it. do you think is something that can affect my interview result?

    • @TechDummiesNarendraL
      @TechDummiesNarendraL  4 роки тому +2

      If you are not a full stack developer, I don't see a point in asking system design question.
      But I would expect you to understand Design patterns

  • @oopsywtf
    @oopsywtf 5 років тому

    How can optimistic lock solve the problem of 2 or more concurrent connections not updating the version to a different one after checking the versions simultaneously ?

    • @TechDummiesNarendraL
      @TechDummiesNarendraL  5 років тому

      There will be a local transaction which stops from version conflicts

  • @puneet6896
    @puneet6896 3 роки тому

    Audio quality is not good.

  • @yashprajapati4061
    @yashprajapati4061 5 місяців тому

    come on man, please listen to your video, do some editing before uploading

  • @mattbrody1424
    @mattbrody1424 2 роки тому

    Man "kind of..." "like..." .etc are not precise technical terms...contention would do the job, concurrency etc your tutorial is mediocre in terms of quality of explaining those important topics in a succinct and clear technical terms.

  • @mattbrody1424
    @mattbrody1424 2 роки тому

    How do you know that pessimistic lock is mostly used ? Do you have any data, stats to prove it ? I guess not...so you statement is not valid, sucks ok, ok....ok :-)

  • @amareshsat
    @amareshsat 3 роки тому

    Didn't like