Laravel Octane with Swoole - Beyond the Basics

Поделиться
HTML-код
  • Опубликовано: 25 май 2021
  • A deeper look into Laravel Octane with Swoole.
  • КиноКино

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

  • @tarsisioxavier
    @tarsisioxavier 3 года назад +5

    I didn't have any interest in Octane until now. Your videos are inspiring!

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

    Very clear explanation. Thank You.

  • @amaelftah
    @amaelftah 3 года назад +3

    this is so informative video. thanks a lot Mohamed for sharing these awsome info

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

      My pleasure :)

  • @ajitkumarchauhdary7885
    @ajitkumarchauhdary7885 11 дней назад

    Awesome bro, i will try this, thanks for the info.

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

    This video is fantastic! Thank you so much!!!

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

      Glad you liked it :)

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

    I want his chair... nice informative video too !

    • @themsaid
      @themsaid  3 года назад +2

      Thanks for watching! It's this one www.ikea.com/eg/en/p/jaervfjaellet-office-chair-glose-black-90363553/

  • @Vali615
    @Vali615 2 года назад +17

    Your missing one very important thing. With Swoole, that static variable/singleton is only shared between requests that are processed on the same thread.

    • @ilyasozkurt9041
      @ilyasozkurt9041 2 года назад +4

      You're definitely right. This is the key thing, if you do not know this will make you lose yourself while debugging.

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

      Interesting, and what would cause a process to run on another thread?

    • @CaimAstraea
      @CaimAstraea 11 месяцев назад

      This is quite scary to be honest >.< I'd love to try this in a real project but all the magic happening in the back is scary. Would you ecounter issue with sessions and redis and queues and other stuff ?

    • @Vali615
      @Vali615 11 месяцев назад +1

      @@CaimAstraea on a 24 core server, you can have 24 threads, each with up to 10k coroutines doing IO stuff. This means potentially 240k connections to your database server. And if you have 10 servers, that's 2.4mill connections.
      So you need to add some buffering proxy on local host.

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

    Video is great but a bit confusing as knowing what is returned at when is quite difficult. My question is if am saving from a form would octane return other previous request made or just the current one as it clones a new instance of the previously bootstrapped app

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

    Perfect video Mohamed thank you! I have a question, I am running Octane with php artisan octane:start --watch, which is logging all requests in my console. How can I ignore certain requests to render? I am using Laravel Telescope which is spamming my console with logging requests

  • @stefankrejci4306
    @stefankrejci4306 3 года назад +3

    Uuuh, I live those deep diving videos, thanks a lot!
    Nice shot 'besides queues' SInce I got 7 queue workers running stable, I want to push everything to the queue ;-).

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

      Queues are GREAT!

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

    Thanks for sharing

  • @thedhruvjoshi
    @thedhruvjoshi 3 года назад +2

    Thnks a lot

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

    Thank you

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

    Question :i sit production ready.
    Will any packages cause problems

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

    Very Goood video.

  • @user-jx8uz6tb6k
    @user-jx8uz6tb6k Год назад

    Thanks, very much! I always wanted to use swoole, but I was afraid of the statefulness of the app.

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

    thanks a lot!

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

      You're welcome :)

  • @33sprog5min2
    @33sprog5min2 Год назад

    Hello Sir
    Thanks for your video
    i have replayed the video many times
    i succeed to install laravel octane
    but when it comes to check a route to make a redirection i'm lost

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

    الله ينور عليك

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

    What's the reason for creating a fresh instance on each request? What would be the disadvantages of reusing the original instance as Node.js does?

    • @themsaid
      @themsaid  3 года назад +7

      To avoid mutations passing from one request to another. Not all PHP libraries and packages are ready for stateful yet.

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

    fantastic video! thanks!!! by the way would the services behave differently when they are resolved by deferrable providers? these kind of services may behave stateless even when they got manipulated in the boot method,right?

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

      Deferred providers are all loaded when running on Octane. In other words, there's no deferred between deferred providers and regular providers on Octane.

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

      @@themsaid Thanks for your share! learned something new

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

    in the async DB queries what will happen when the workers are full?, will it wait until they are free or run as usual sequence DB queries ?

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

      If all workers are busy, Swoole will wait until they're available.

  • @user-jx8uz6tb6k
    @user-jx8uz6tb6k Год назад +1

    In php-fpm, we can configure child processes count created. What about swoole-laravel? Does 1 instance process all requests?
    If my end point just dispatches a job (in mysql), is this should be in the same coroutine, or should it be dispatched?

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

    which one is faster app->singletone or app->bind?

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

    Thnx man, great video. Do u know when octane will be available for Lumen ?

    • @themsaid
      @themsaid  3 года назад +2

      I don't think it will ever be. Use Laravel :) Much faster and more powerful

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

      @@themsaid Big existing project, many products depend on it and it will be annoying to port and lots of work for QA team. Anyway thank you for your answer :)

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

      @@themsaid Why should i use lumen then if laravel is faster ?

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

      @@HishamElsayad You shouldn't, that's the point. There is basically no advantages to using Lumen anymore.

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

      @@bojanvmk Sure laravel with octan is much faster than lumen
      But lumen is faster than laravel

  • @ahmadkamal4405
    @ahmadkamal4405 3 года назад +4

    Great video Mohamed, I have a question.
    By using octane running on swoole we can easily run Jobs in the background and we won't use Supervisor anymore, right?

    • @themsaid
      @themsaid  3 года назад +8

      You need Supervisor to keep Octane running. And you still need it to keep your queue workers running as well. Octane isn't a replacement for queue workers.

    • @osta6172
      @osta6172 2 года назад +1

      @@themsaid thank you for the great video. Could you explain a little bit when we want to use queue workers vs Octane's concurrently method ? Is there a drawback of using concurrently in some cases ? Can we say that we use queues for tasks for which we don't need return information (ex. sending mail in background) ?

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

    Thanks a lot Mohammed. But I wonder how its handle db connections on Octane with Swoole. Is there any connection pools for not to create a db connection for every request or every request is new db connection same as classic php fpm application?

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

      Octane holds a single DB connection per worker. So no need for connection pooling until we decide to support coroutines.

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

      @@themsaid awesome. Thanks

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

    start with Laravel Octane with swoole php extension ,that is incredibly fast due to swoole cache instead of any other cache driver.Thanks

  • @ahmeraliqaiser3551
    @ahmeraliqaiser3551 9 месяцев назад

    Can I use swools on windows ?

  • @konskript123
    @konskript123 Месяц назад

    why it doesn't download the swoole when installing?

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

    Sorry but i would have a question using a multitenant app, specially with the tenancy provider configureRequest, so when swoole builds the app, cant find the tenant ti use cause logically is not getting any request, so my question is where is the best place to move that logic, and thanks a lot you are a hero

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

      Well i created a global middleware that is in charge on configuring the tenant snd seems to work fine, i noticed that the initial memory used is like 23mb is it normal? And then for every request my memory goes up, so i guess i have a memory leak somewhere

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

      Seems like you have a memory leak yes. These are hard to detect, I'm afraid there's no easy way :)

  • @mahmudulhasan1360
    @mahmudulhasan1360 3 года назад +7

    thanks for your video. can you please make one video about laravel octane multi-tenancy app, please?

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

      Hello @mahmudul, have you complete multitenant app with seperated DBs ? And which package are used ? if Yes so please contact me twitter @DevDhruvJoshi ,

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

      @@thedhruvjoshi I'm working on separate DB multi-tenant app. I don't use any package for it, i use my own package based on this channel multi-tenant video idea.

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

      @@mahmudulhasan1360 can you share video links, sorry but I couldn't find any video on your channel, so please

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

      @@thedhruvjoshi on this channel, I don't have any video. This channel have one. Mohammed share that

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

      What exactly do you want to know?

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

    Hello Mohamed. I want to access singleton class in web app from Octane::tick . I understood both of them work different php instance. How to access it. If I don't access, could you develop swoole for this :)

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

    Amazing video! I have one question regarding the adding to a static array. If only the container instance is cached and cloned, how come code that isn’t in the scope of the framework is affected by the stateful behavior?

    • @aizazaziz5636
      @aizazaziz5636 9 месяцев назад

      You have to restart the server

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

    Swoole make PHP grate again !

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

    Can octane concurrent run query builder request to DB ?

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

      yes

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

      @@themsaid Thank you. Subbed. Great content, will try octane later this week :)

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

    This is a very informative video, But I am confused at 12:21,
    Can you please guide me on what should I do in this case:
    I have a `ThemeViewFinder` class that extends Laravel's `FileViewFinder`.
    ```
    use Illuminate\View\FileViewFinder;
    class ThemeViewFinder extends FileViewFinder
    {
    }
    ```
    And I am using the singleton in the service provider like this:
    ```
    public function register()
    {
    $this->app->singleton('theme.finder', function ($app) {
    $themeFinder = new ThemeViewFinder(
    $app['files'],
    $app['config']['view.paths']
    );
    $themeFinder->setHints(
    $app->make('view')->getFinder()->getHints()
    );
    return $themeFinder;
    });
    }
    ```
    Now, what modifications should I make here?

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

      Nothing! It looks good to me.

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

      @@themsaid Thanks,
      At 12:21, I thought you said always pass the closure. That's why I asked that question.

  • @michabbb
    @michabbb 2 года назад +1

    you always say "in-a-stance" but you mean "instance", right? just to be sure, I don't miss anything.

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

    Peache pea

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

    Excuse me, but doesn't laravel code just feel like code porn? I just like reading or looking at Laravel code.

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

    Clear as mud. lol