Closed jlibx closed 3 years ago
Hi @z-golly ,
I think it's related to number limit of file descriptors
on your system kernel.
Try to run ulimit -n
to see the number. You can run sudo ulimit -n 10240
to change the config temporarily to see if it works.
@albertcht I have tried to set it, but the error still occurs
@z-golly may be give this a try
Increase the limit by editing /etc/sysctl.conf
and add this line to the end of the file:
fs.inotify.max_user_watches=524288
And then run sudo sysctl -p
@taylorotwell @aftabnaveed @albertcht I didn't find this problem when I used it in the Windows Docker environment.
When there is a database query, there is no performance improvement. This makes me feel very puzzled.
/**
* @return JsonResponse
*/
public function version()
{
return response()->json(['version' => app()->version()]);
}
/**
* @param Request $request
* @param $id
* @return JsonResponse
*/
public function show(Request $request, $id)
{
$request->query->set(
'with',
'jds.addresses.province,jds.addresses.city,jds.educationName,typeName,scaleName,industries,province,city'
);
$company = (new Company())->filter($request->query())->findOrFail($id);
return (new CompanyShowResource($company))->response();
}
Database queries won't by default start executing asynchronsuly you need to execute it through Octane::concurrently
use App\User;
use App\Server;
use Laravel\Octane\Facades\Octane;
[$users, $servers] = Octane::concurrently([
fn () => User::all(),
fn () => Server::all(),
]);
All I/O operations in Laravel Octane now should still be blocking I/O. Octane::concurrently
seems using SwooleTaskDispatcher
by default. That means concurrently
now can only help you decrease total waiting time of multiple I/O operations. These I/O operations still block Swoole's task workers. It won't help boost your qps significantly.
Unless coroutine feature is fully supported in Laravel, otherwise contexts between different coroutines may lead unexpected results.
@albertcht does that mean we won't be able to use go
functions with octane
? I am thinking if Laravel does not provide it then why not use Swoole's utility functions directly?
Swoole::concurrently(...)
uses go()
(or actually the long version of it, see #100) under the hood. It allows you to execute multiple commands in parallel, but not in a fully asynchronous style we know from other languages like C#.
Whether Octane has an impact on request times depends on the tasks performed on the server. The more I/O is involved, the less noticeable it will be in the end. But for high traffic sites with content that can be cached easily, Octane is a great plus nonetheless.
What I'm not sure about is the Coroutine MySql Extension provided by Swoole. The documentation is lacking in my opinion, but maybe it can improve performance of queries further.
Coroutines are currently disabled when using Octane. We're planning to work on adapting the framework and first party packages for it first.
Description:
wrk -c20 -d5s http://127.0.0.1:8000/api/companies
log is
Steps To Reproduce: