Skip to content

Redis backed SimpleClient high CPU Usage #329

Closed

Description

@bibstha

While trying to play around with SimpleClient, I've noticed the CPU usage to get very high:

PHP: 7.1
Redis: 3.2.9

<?php
include __DIR__.'/vendor/autoload.php';

use Interop\Queue\PsrMessage;
use Interop\Queue\PsrProcessor;
use Enqueue\Util\JSON;
use Enqueue\SimpleClient\SimpleClient;

$client = new SimpleClient('redis://127.0.0.1:6379?vendor=predis');

$client->bind('a_bar_topic', 'a_processor_name', function(PsrMessage $psrMessage) {
    var_dump(JSON::decode($psrMessage->getBody()));
    return PsrProcessor::ACK;
});

$client->consume();

And redis is running in the background.

When running the above php file, CPU usage for both redis-server and php becomes high:

screen shot 2018-01-17 at 12 29 10 am

I noticed that --receive-timeout and --idle-timeout were added in #193 but I am not sure how to send these parameters using SimpleClient.

Currently, I'm not able to use SimpleClient at all.

Thanks

Activity

  1. makasim commented on Jan 17, 2018

    @makasim
    Member

    I noticed that --receive-timeout and --idle-timeout were added in #193 but I am not sure how to send these parameters using SimpleClient.

    $client->getQueueConsumer()->setReceiveTimeout(5000); // 5 sec
    $client->getQueueConsumer()->setIdleTimeout(1000); // 1 sec
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions