Using Swoole as Franken is missing some core caching features that don’t yet work with Octane. Using it in production, works great.
One thing to keep in mind is that I think almost every app I’ve ever worked on using Laravel has n+1 issues everywhere unless they were smart enough to force it to fail. If any n+1 issues occur. Solving this, will really speed things up in your app, and I would do this first as it’s just thrashing the connection from your app to the db.
Using Socketi in production. It works, has not caused us any problems. We use it primarily for chat but also for sending things like notifications to our logged in users on the web client
Just recapping what other people said and adding some of my own colour/opinions on this subject:
API response size and response time are most likely not connected. Especially dealing with such a small response footprint. Perhaps if you start getting into responses in the MB/GB ...IO performance becomes a factor, these two could be connected. Not the case here.
Use /u/tontonsb suggestion of creating the most simple example of an API response to get your PHP/Laravel baseline response time. From there you can start adding layers such as logging, SQL queries, etc, to understand what is causing your slowdown
Follow /u/nielsd0's suggestion and learn about PHP OPCache. Especially under PHP 7.4 since it requires a bit more work to utilize it correctly.
If you are able to upgrade to PHP 8/*, PHP 8 added jit compilation used with OPCache and makes dealing with OPCache almost invisible to the developer. [Best of both worlds! Here's a link for more info and setup instructions](https://stitcher.io/blog/php-8-jit-setup). I've been PHP 8.0.3 in production for 6+ months, so no worries there.
I have had API response times as low as ~45ms PHP 7.4/Laravel 8, even when executing optimized MySQL selects with JSON response. So yes, 600ms is expensive'ish (far from the worst though). This gives you a VERY ANECDOTAL sense of what can be be achieved when dealing with NGINX/PHP/Laravel/MySQL
In my experience of dealing with slow API calls that utilize databases, slow or non-existent table indexes for executed queries are responsible for ~85% of your problems. Tackle this challenge once you have your baseline 'hello world' API call responding quickly.
Before you start adding caching components, using Redis, or Laravel Octane to improve performance, figure out the core reasons for the initial slow API response. This will ensure that your caching attempts are not just masking an underlying problem, and impacting your base assumptions around performance/scalability of your tech stack
Some of these discoveries were hard earned and have directly contributed to my grey hair count! Best of luck!
I’ve created a local docker configuration for Octane and one without Octane w/ xdebug, but otherwise they are exactly the same. I wasn’t wanting to deal with setting up a new debugger for my dev environment and xdebug just ‘works’
Takes 2-3 mins to switch between these different docker container config
I added Laravel Octane using Swoole to our PHP8 app to do some performance comparisons. I noticed an average reduction in http response times by ~58% using a moderate traffic load. All this and considerably lower CPU usage.
If you use Laravel, you should definitely check out Octane.
Good stuff! Thank you
Thanks for posting this! Looks like some good learnings in here. Going to read this in detail tonight.
Amen to that!
Using Swoole as Franken is missing some core caching features that don’t yet work with Octane. Using it in production, works great.
One thing to keep in mind is that I think almost every app I’ve ever worked on using Laravel has n+1 issues everywhere unless they were smart enough to force it to fail. If any n+1 issues occur. Solving this, will really speed things up in your app, and I would do this first as it’s just thrashing the connection from your app to the db.
After this though, let Octane rip!
She’s so lovely
Something doesn’t sound right here. What do you see when you run EXPLAIN your_query
Could one of you who uses this a lot expand on why this has benefited your development? I am a tinker user
Phpstorm is an ide, vscode is an editor. An amazing editor, but it’s hard to compare the two. Phpstorm is amazing. You should give it a try
Nice little refresher, thx
It’s the crypt keeper!
Nice little snippet there. Thank you very much
Been using Soketi in production successfully for a while with zero issues. Sending out tens of thousands of notifications daily
Using Socketi in production. It works, has not caused us any problems. We use it primarily for chat but also for sending things like notifications to our logged in users on the web client
*Grabs popcorn
I understand the financial decision from the studios perspective. At the same time it does not make it any less morally bankrupt.
If he was engaging in predatory behaviour after the film was shot, does that make it any better? Absolutely not.
I’m curious to see the consumer blow back for sticking with the release.
Could you imagine deciding to proceed with a project with a child groomer because of the financials of dropping the project. Pretty fucked!
Include the output of phpinfo() here. This will provide some clues. Also what OS are you running this on? Also what web server are you using?
Just recapping what other people said and adding some of my own colour/opinions on this subject:
Some of these discoveries were hard earned and have directly contributed to my grey hair count! Best of luck!
Nice and simple . I like it
I have not. I have been looking for such a package though since I was not wanting to write this myself
This is really cool
Is the discord more active than this sub? Not a big discord user but might check it out if it has more activity
I’ve created a local docker configuration for Octane and one without Octane w/ xdebug, but otherwise they are exactly the same. I wasn’t wanting to deal with setting up a new debugger for my dev environment and xdebug just ‘works’
Takes 2-3 mins to switch between these different docker container config
Sorry, replied early in the morning. 58%
I added Laravel Octane using Swoole to our PHP8 app to do some performance comparisons. I noticed an average reduction in http response times by ~58% using a moderate traffic load. All this and considerably lower CPU usage.
If you use Laravel, you should definitely check out Octane.