what is OPTIMISTIC LOCK?

  Рет қаралды 60,751

Tech Dummies Narendra L

Tech Dummies Narendra L

Күн бұрын

Пікірлер: 63
@RussianCyclop
@RussianCyclop Жыл бұрын
Great explanation, thank you sir.
@srikanthrachala
@srikanthrachala 4 жыл бұрын
Very nice and detailed explanation !!. Thank you
@jksharma7
@jksharma7 5 жыл бұрын
my friend you are so GREAT !!
@80kg
@80kg 3 жыл бұрын
great content thank you sir
@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 жыл бұрын
Thanks, Narendra! Your tutorials have always been good.
@CodingWorldWithNinja
@CodingWorldWithNinja 3 жыл бұрын
thanks Narendra i helps a lot me to understand locks on DB
@rettipatti
@rettipatti 3 жыл бұрын
Good explanation!
@truongquochung4858
@truongquochung4858 3 жыл бұрын
What an excellent video! You explaination is very perspicuous and examples are very practicle. Keep going! 😉
@PratikPatel-fg9xe
@PratikPatel-fg9xe 2 жыл бұрын
Great explanation 👍
@kaushikmitra1982
@kaushikmitra1982 Жыл бұрын
Nice video!!!
@NaturalPro100
@NaturalPro100 5 жыл бұрын
Amazing explanation.Thanks :)
@adanarreola272
@adanarreola272 3 жыл бұрын
Very well explained!
@sharatchandra9198
@sharatchandra9198 4 жыл бұрын
very clear and concise
@агатакристи-г3ы
@агатакристи-г3ы 5 жыл бұрын
Interesting and clear as usual! Thank you, Narendra!
@PANKAJSINGH-lv7iu
@PANKAJSINGH-lv7iu 3 жыл бұрын
If an optimistrick exception is raised then what we do. Can we write some sort of retry logic for the same transaction ??
@logicboard7746
@logicboard7746 2 жыл бұрын
clear like water! thanks bro!
@TamilTV2
@TamilTV2 11 ай бұрын
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?
@adamhughes9938
@adamhughes9938 4 жыл бұрын
Great as usual
@fairytalesnew
@fairytalesnew 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)
@thiwanka.w92
@thiwanka.w92 3 жыл бұрын
Interesting
@soufianeodf9125
@soufianeodf9125 3 жыл бұрын
good content
@sanatandharmu
@sanatandharmu 4 жыл бұрын
Please use a good sound recording device, the sound is suppressed with lot of noise.
@postman12
@postman12 3 жыл бұрын
thumbs up
@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.
@ravikiranbcm
@ravikiranbcm 2 жыл бұрын
nice
@sayantanray9595
@sayantanray9595 5 жыл бұрын
Nice explanation
@atexnik
@atexnik 5 жыл бұрын
Clear explanation! Thanks.
@abhijitprusty
@abhijitprusty 4 жыл бұрын
How to handle conflicts in case of optimistic locks ?
@satishgarepalli5977
@satishgarepalli5977 4 жыл бұрын
could please explain what is a live lock mean??
@marriagedance8657
@marriagedance8657 5 жыл бұрын
Why optimistic is even termed as a lock?
@amanshivhare5592
@amanshivhare5592 4 жыл бұрын
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.
@abhishekkumar9812
@abhishekkumar9812 5 жыл бұрын
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 .
@priyankawagh5217
@priyankawagh5217 4 жыл бұрын
Thanks!
@niloysaha3229
@niloysaha3229 5 жыл бұрын
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 жыл бұрын
You will need to use pessimistic lock/ transaction there. Because you are reading n updating.
@varunvats32
@varunvats32 5 жыл бұрын
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 5 жыл бұрын
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.
@rohanbundelkhandi3202
@rohanbundelkhandi3202 5 жыл бұрын
Please make video on: System Design of Version Control System like git
@北欧码农
@北欧码农 4 жыл бұрын
So optimistic lock also need a lock before verifying version and updating data, but lock period is shorter, right?
@mr-engineer
@mr-engineer 5 жыл бұрын
Awesome! Thanks for a really clear explanation.
@at_tap
@at_tap 5 жыл бұрын
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.
@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 Жыл бұрын
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?
@SteelersRock1190
@SteelersRock1190 5 жыл бұрын
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 жыл бұрын
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!
@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.
@ariellyrycs
@ariellyrycs 4 жыл бұрын
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 жыл бұрын
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
@pramodrawat9113
@pramodrawat9113 5 жыл бұрын
how to handle OPTIMISTIC LOCKING with shading and clusters ?
@charliezhang807
@charliezhang807 5 жыл бұрын
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 жыл бұрын
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
@mohammedamenuddin3675
@mohammedamenuddin3675 4 жыл бұрын
Very clear . Thanks . Does pessimistic lock require version and timestamp . If yes then why
@darksteam999
@darksteam999 Жыл бұрын
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
@puneet6896
@puneet6896 3 жыл бұрын
Audio quality is not good.
@yashprajapati4061
@yashprajapati4061 8 ай бұрын
come on man, please listen to your video, do some editing before uploading
@mattbrody1424
@mattbrody1424 3 жыл бұрын
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 3 жыл бұрын
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
Transactions Internal implementation write ahead log and locks with banking examples
20:39
Distributed Locks | System design basics
28:50
Tech Dummies Narendra L
Рет қаралды 138 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Optimistic Locking - What, When, Why, and How?
16:34
Arpit Bhayani
Рет қаралды 17 М.
How to Remember Everything You Read
26:12
Justin Sung
Рет қаралды 3,6 МЛН
This is why understanding database concurrency control is important
9:05
Whatsapp System design or software architecture
27:40
Tech Dummies Narendra L
Рет қаралды 257 М.
System design basics: Learn about Distributed file systems
18:41
Tech Dummies Narendra L
Рет қаралды 59 М.
System Design: Concurrency Control in Distributed System | Optimistic & Pessimistic Concurrency Lock
1:04:45
How Distributed Lock works | ft Redis | System Design
10:24
ByteMonk
Рет қаралды 13 М.
Reinforcement Learning: Machine Learning Meets Control Theory
26:03
Steve Brunton
Рет қаралды 297 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.