Laravel solved race conditions

Поділитися
Вставка
  • Опубліковано 30 січ 2025

КОМЕНТАРІ • 67

  • @ahmad-murery
    @ahmad-murery Рік тому +20

    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!

  • @bballantyne3
    @bballantyne3 Рік тому +6

    Your presentation style is ideal for me. Thank you!!!

  • @alchemist_dk
    @alchemist_dk Рік тому +6

    This channel is pure gold, thanks for all the info.

  • @irvanicsmoke1132
    @irvanicsmoke1132 Рік тому +5

    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!

    • @aarondfrancis
      @aarondfrancis  Рік тому +3

      You mean database locking? I might cover that on the PlanetScale channel!

  • @SurprisingLee
    @SurprisingLee 9 місяців тому

    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.

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

    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".

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

    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!

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

    sifu, you are very talented at transferring knowledge

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

    I've requested this topic a few times. Thanks for delivering ❤

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

    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

  • @demian.succs0
    @demian.succs0 Рік тому

    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

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

    love you Aaron! The way you explained really makes me easy to understand the laravel and mysql. kudos!

  • @davidharting3119
    @davidharting3119 Рік тому +2

    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.

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

    I don't have anything to say except that you make fantastic videos!

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Well I'm glad you said that! That makes my day. Thank you

  • @ajzack983
    @ajzack983 8 місяців тому

    does this relate to ShouldBeUnique interface of the laravel jobs ?

  • @Voltra_
    @Voltra_ Рік тому +3

    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

    • @pookiepats
      @pookiepats 4 місяці тому

      Reads like a poser

    • @Voltra_
      @Voltra_ 4 місяці тому

      @@pookiepats try me biche 🦌

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

    Whats the different between pessimistic locking and cache lock?

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

    Incredible!

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

    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?

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

      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.

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

    Nice that this is built in

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

    Does someone know if the octane cache driver is supported?

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

    Please, make an video about the Drupal 10?? Thank you!!!

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

      You don't have to comment the same thing on every video 🫠

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

    So good

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

    wow what a clever way to solve locks by inserting a unique key lol never thought of that xD

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

    Great video!

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

    Did you just use tailwind in the terminal?!!!! Omg 😮😍🤩

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Haha yup! 07:10 I mention Termwind!

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

      @@aarondfrancis Yeah I could not believe my eyes, I had to verify this magic 😂

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

    I think its similar to withoutOverlapping() in task scheduler

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

    But this lock won’t works if we use file cache

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

    Php guys finally enters the enterprise area.
    Great feature by the way.

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

    Thanks very good

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

    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.

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

      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.

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

      @@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
      @aarondfrancis  Рік тому +1

      Some of the things you learned a long time ago, other people have not yet learned! And thus the wheel of time continually turns.

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

    Hey man, great content. Would you be interested in making a video on your IDE and terminal configuration?

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Potentially! Although I don't really customize my setup hardly at all. It's just pretty standard PHP storm

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

      @@aarondfrancis Font and theme

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

    Would be cool to make an equivalent in js with other db locks.

    • @aarondfrancis
      @aarondfrancis  Рік тому +1

      Yup that'd be really neat! Could be a Prisma or Drizzle plugin maybe

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

    we better stick with redis since it's really easy to share between completely different servers.

  • @lighty262
    @lighty262 Рік тому +1

    Kinda similar to flock function in PHP

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

      Does that communicate across processes? I'm not familiar with it

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

      @@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.

  • @sezohessen7485
    @sezohessen7485 6 місяців тому

    WOWWWWW

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

    give a real example using job with atomic locks on race condition case like inserting data

  • @travelcouple-z1m
    @travelcouple-z1m Рік тому

    This is like golang 😮

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

    But this lock won’t works if we use file cache

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

      For multiple processes on the same server it will. Mentioned at the end