Coder Social home page Coder Social logo

Comments (10)

themsaid avatar themsaid commented on May 19, 2024 19

Coroutines are currently disabled when using Octane. We're planning to work on adapting the framework and first party packages for it first.

from octane.

albertcht avatar albertcht commented on May 19, 2024

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.

from octane.

libxj avatar libxj commented on May 19, 2024

@albertcht
I have tried to set it, but the error still occurs

from octane.

aftabnaveed avatar aftabnaveed commented on May 19, 2024

@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

from octane.

libxj avatar libxj commented on May 19, 2024

@taylorotwell @aftabnaveed @albertcht I didn't find this problem when I used it in the Windows Docker environment.

from octane.

libxj avatar libxj commented on May 19, 2024

When there is a database query, there is no performance improvement. This makes me feel very puzzled.

laravel version

code

    /**
     * @return JsonResponse
     */
    public function version()
    {
       return response()->json(['version' => app()->version()]);
    }

nginx+fpm

1617845426(1)

octane

1617845383(1)

query

code

      /**
     * @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();
    }

nginx+fpm

1617845556(1)

octane

1617845706(1)

from octane.

aftabnaveed avatar aftabnaveed commented on May 19, 2024

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(),
]);

from octane.

albertcht avatar albertcht commented on May 19, 2024

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.

from octane.

aftabnaveed avatar aftabnaveed commented on May 19, 2024

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

from octane.

Namoshek avatar Namoshek commented on May 19, 2024

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.

from octane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.