GithubHelp home page GithubHelp logo

Comments (7)

udokmeci avatar udokmeci commented on August 12, 2024

@adrianpaiva1 This is probably beacuse of the 'ticks' are removed. You can use it like this or can add 'sleep' to your controller.
To investigate it further can you please let me know which version of php you are using?
Thanks,

from yii2-beanstalk.

adrianpaiva1 avatar adrianpaiva1 commented on August 12, 2024

Hi I'm running PHP 7.1.71. Thanks for looking into this, love this library!

I currently have the sleep setting at 3.

Just give you some more info, none of the workers were actually processing jobs. They had crazy high CPU usage without any jobs.

from yii2-beanstalk.

udokmeci avatar udokmeci commented on August 12, 2024

Hi again,
Sleep 3 is very low i mean you can set it something like 100. It is ms. Still it should reduce CPU usage, did it?
Thank you for support.

from yii2-beanstalk.

drsdre avatar drsdre commented on August 12, 2024

Hi, I have the same issue since I installed the last version.

This is the unchanged config which causes high CPU load on both the PHP worker process and the beanstalk process:

'beanstalk'    => [
			'class'          => 'udokmeci\yii2beanstalk\Beanstalk',
			'host'           => '127.0.0.1',
			'port'           => 11300,
			'connectTimeout' => 1,
			'sleep'          => 60,
		],

I've changed the sleep value to 1000, but not no avail.

A different software package that uses the previous version of yii2-beanstalk uses sleep 60 to and does not show out of bound CPU usage.

Andre

from yii2-beanstalk.

drsdre avatar drsdre commented on August 12, 2024

It looks like the issue is pointing to getting a RESPONSE_TIMED_OUT whilst trying to reserve the tube in beforeAction of BeanstalkController.php (lines 303-320):

$job = $bean->reserve(0);
if (!$job) {
  continue;
}

Using time-out of 0 keeps the process cycling in the while loop and consuming all available CPU cycles. The after job sleep needs to be added before the continue to fix this issue.

from yii2-beanstalk.

drsdre avatar drsdre commented on August 12, 2024

Added pull request #37 to make CPU load manageable through sleep.

from yii2-beanstalk.

udokmeci avatar udokmeci commented on August 12, 2024

Thanks merged and released! Controller or Component could also have a default timeout for reserve method.

from yii2-beanstalk.

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.