I wish you can make more Laravel courses just like the MySql for developers series where you start with the basics but with good details. Thanks Aaron!
this is why i subbed for!! Your explanation is always easy to understand and the delivery is so enjoyable :D Would be great if you also explain concurrency control like optimistic vs. pessimistic locking. Thanks once again Aaron!
Having written almost exactly this locking system to prevent a race condition on Laravel v9, for ecommerce checkout no less, I can appreciate the good design behind this.
I'm just so happy that we have you on our side. You are a great teacher and visualizing the examples vastly improves the learning experience. Thank you, Aaron! As a side note, I think it would be great if you could clean up the IDE a bit, as it distracts the viewer from the main content. I think hiding the "Tool Window Bars" would be a great start. You can find the option to hide them under Settings => Appearance & Behavior => Appearance => Tool Windows. Or just hit the shift key twice and search for the "tool window bars".
I have been using Laravel for a ten years or so, but not in-depth for the last two. I need to look at this, this looks like a great improvement, thanks for the tip-off!
Awesome video and explanation on how to use atomic locking :) Even though I've used them and know how they work, it was a nice overview and confirmation that I was using them properly :D
Maybe it’s a common Laravel idiom but doing while(1) instead of while(true) has a very devil-may-care attitude to it. I must say it shivered my timbers.
You'd be surprised how many web developers don't know/understand that the web is a fundamentally distributed system and thus don't use any kind of synchronization primitives when they're required
Great video as per! Can this be used in a simple user request so only one user can do something at once.. lets say on checkout? or is this used primarily in worker/job based solutions?
It totally could, I suppose! You might need a little more scalable, robust strategy for that though. If you've got thousands of users fighting over a single lock, that's probably gonna create a pretty gnarly bottleneck. Something like this would be more useful for coordinating backed processes fighting for limited resources.
how are database and file locks surprising? A database lock can be great when migrating data, so it's locked to prevent new data to be inserted. And file locks can be great if a file is still being written to, before reading it. or some other reason.
A database lock is not surprising! Using a plain ol' unique key as a shared application lock is surprising, and quite clever. You might enjoy some of my database videos at youtube.com/@planetscale.
@@aarondfrancis Maybe I'm misunderstanding the issue then. I come from a software engineering background. and worked with low-level hardware too. And using a Mutex (or semaphores) to lock stuff is not new, and can also be done with plain-text keys in most systems. so I must be too set into my mindset to miss a point here I think.
@@aarondfrancis It uses file system lock/release instead of caching driver in your video, all php process will use flock function to check wether the file is lock or not, that's how they communicate.
I wish you can make more Laravel courses just like the MySql for developers series where you start with the basics but with good details.
Thanks Aaron!
Your presentation style is ideal for me. Thank you!!!
This channel is pure gold, thanks for all the info.
this is why i subbed for!! Your explanation is always easy to understand and the delivery is so enjoyable :D
Would be great if you also explain concurrency control like optimistic vs. pessimistic locking.
Thanks once again Aaron!
You mean database locking? I might cover that on the PlanetScale channel!
Having written almost exactly this locking system to prevent a race condition on Laravel v9, for ecommerce checkout no less, I can appreciate the good design behind this.
I'm just so happy that we have you on our side. You are a great teacher and visualizing the examples vastly improves the learning experience. Thank you, Aaron!
As a side note, I think it would be great if you could clean up the IDE a bit, as it distracts the viewer from the main content. I think hiding the "Tool Window Bars" would be a great start.
You can find the option to hide them under Settings => Appearance & Behavior => Appearance => Tool Windows.
Or just hit the shift key twice and search for the "tool window bars".
Good idea! Thank you
I have been using Laravel for a ten years or so, but not in-depth for the last two. I need to look at this, this looks like a great improvement, thanks for the tip-off!
Glad you liked it!
sifu, you are very talented at transferring knowledge
I've requested this topic a few times. Thanks for delivering ❤
Awesome video and explanation on how to use atomic locking :) Even though I've used them and know how they work, it was a nice overview and confirmation that I was using them properly :D
I've seen your videos on the planet scale channel and didn't know you have yours own lol, thanks UA-cam algorithm to take me to the right place
love you Aaron! The way you explained really makes me easy to understand the laravel and mysql. kudos!
Maybe it’s a common Laravel idiom but doing while(1) instead of while(true) has a very devil-may-care attitude to it. I must say it shivered my timbers.
Clutching my pearls!
I don't have anything to say except that you make fantastic videos!
Well I'm glad you said that! That makes my day. Thank you
does this relate to ShouldBeUnique interface of the laravel jobs ?
You'd be surprised how many web developers don't know/understand that the web is a fundamentally distributed system and thus don't use any kind of synchronization primitives when they're required
Reads like a poser
@@pookiepats try me biche 🦌
Whats the different between pessimistic locking and cache lock?
Incredible!
Great video as per! Can this be used in a simple user request so only one user can do something at once.. lets say on checkout? or is this used primarily in worker/job based solutions?
It totally could, I suppose! You might need a little more scalable, robust strategy for that though. If you've got thousands of users fighting over a single lock, that's probably gonna create a pretty gnarly bottleneck. Something like this would be more useful for coordinating backed processes fighting for limited resources.
Nice that this is built in
Does someone know if the octane cache driver is supported?
I'm not sure!
Please, make an video about the Drupal 10?? Thank you!!!
You don't have to comment the same thing on every video 🫠
So good
wow what a clever way to solve locks by inserting a unique key lol never thought of that xD
Sneaky right
Great video!
Did you just use tailwind in the terminal?!!!! Omg 😮😍🤩
Haha yup! 07:10 I mention Termwind!
@@aarondfrancis Yeah I could not believe my eyes, I had to verify this magic 😂
I think its similar to withoutOverlapping() in task scheduler
But this lock won’t works if we use file cache
Across multiple processes on the same server it will!
Thanks
Php guys finally enters the enterprise area.
Great feature by the way.
Haha, I guess?
Thanks very good
how are database and file locks surprising? A database lock can be great when migrating data, so it's locked to prevent new data to be inserted. And file locks can be great if a file is still being written to, before reading it. or some other reason.
A database lock is not surprising! Using a plain ol' unique key as a shared application lock is surprising, and quite clever. You might enjoy some of my database videos at youtube.com/@planetscale.
@@aarondfrancis Maybe I'm misunderstanding the issue then. I come from a software engineering background. and worked with low-level hardware too. And using a Mutex (or semaphores) to lock stuff is not new, and can also be done with plain-text keys in most systems. so I must be too set into my mindset to miss a point here I think.
Some of the things you learned a long time ago, other people have not yet learned! And thus the wheel of time continually turns.
Hey man, great content. Would you be interested in making a video on your IDE and terminal configuration?
Potentially! Although I don't really customize my setup hardly at all. It's just pretty standard PHP storm
@@aarondfrancis Font and theme
Would be cool to make an equivalent in js with other db locks.
Yup that'd be really neat! Could be a Prisma or Drizzle plugin maybe
we better stick with redis since it's really easy to share between completely different servers.
Agreed! Redis or db.
Kinda similar to flock function in PHP
Does that communicate across processes? I'm not familiar with it
@@aarondfrancis It uses file system lock/release instead of caching driver in your video, all php process will use flock function to check wether the file is lock or not, that's how they communicate.
WOWWWWW
give a real example using job with atomic locks on race condition case like inserting data
This is like golang 😮
But this lock won’t works if we use file cache
For multiple processes on the same server it will. Mentioned at the end