Very helpful. As a performance and the premature optimization freak I liked the part where you showed how unnecessary Concurrency calls caused larger memory usage and longer request durations.
@codecourse2 ай бұрын
Yep, I made sure to include this because it’s so easy to get into the trap of using perf features like this without thinking! Glad you found this helpful.
@HumpaLumpaBiriBam2 ай бұрын
thank you for short & straight to the point tutorials
@codecourse2 ай бұрын
My pleasure, glad they help!
@princejohnsantillan2 ай бұрын
I'm curious to know why running them concurrently took longer.
@onessimuslyngdoh2892 ай бұрын
Probably because the tasks need to be serialised for processing and their results de-serialised. For light tasks, the serialisation and de-serialisation just add needless overhead
@codecourse2 ай бұрын
Yep, correct. Thanks for responding! As mentioned in the course it’s not ideal for fast code execution that wouldn’t make much difference to the response time. I think the official docs show the example of generating a report, which is the kind of thing this would be much more suitable for.
@pawelabrams2 ай бұрын
@@onessimuslyngdoh289exactly, remember that serialization is done twice: closure is serialized on its way to artisan and deserialized there, then the result is serialized on artisan's side and deserialized in the web process. If you actually return the users to the endpoint, they would be serialized again, this time to JSON. Ideal task to send to background is one that has a defined, easy input (eg. one method call) and a defined short output (eg. filename), yet contains a lot to do in the meantime (eg. get data from two sources and mangle it together to create a PDF file with summary). Then only having _two or more_ of these together will gain you any perf improvements.
@jamessilvey55652 ай бұрын
Use PHP-FPM OR OCTANE Otherwise will not in artisan serve
@estabansenorbanana53552 ай бұрын
Great explaination, but the font spacing simply distracts me the entire time..
@codecourse2 ай бұрын
Ah sorry about that!
@alanis4AL2 ай бұрын
Thank you
@codecourse2 ай бұрын
You're welcome!
@mdlimonrana82882 ай бұрын
Is that possible to run api call inside this? I tried it but it’s not working
@codecourse2 ай бұрын
I haven’t tried personally, but it wouldn’t surprise me if this didn’t work. Aside from that, it’s probably not the most suitable method of making an API call, best to just make the call normally.
@mdlimonrana82882 ай бұрын
@@codecourse thanks for your reply. Actually I have tried to implement a feature, where I have to call 7 API call together for user api events testing. That’s why I thought that can be useful there. But unfortunately it didn’t works with that. That’s why I asked you about that.
@michaelbrevig2 ай бұрын
@@mdlimonrana8288 What exactly isn't working for you? Are one of your calls timing out? Does it work if you use sync as the driver? What error are you getting?
@codecourse2 ай бұрын
@@mdlimonrana8288 Feel free to post over in the forum (codecourse.com/forum) if you don't figure this out, and I'd be happy to dive more into this there.
@pawelabrams2 ай бұрын
Laravel docs state that the closure is serialized before it's sent to artisan... maybe the required variables are out of scope after the serialization process.
@fractal-tess2 ай бұрын
promise.all? just how bad is php if this is not core?