Skip to content

Redis consumer has very high resource usage #191

Closed

Description

@JunkMyFunk

I have configured the Symfony bundle to use Redis via php-redis. The queue producer and consumer are working, however when I run the console command php app/console enqueue:consume --setup-broker it seems to poll Redis every few milliseconds causing the PHP script to have about 50% CPU usage and Redis about 20%.

Is there an option to set a timeout to reduce the polling rate and reduce resource usage?

PHP 5.6
Redis server 2.8.4
symfony/symfony: 2.8.27
enqueue/async-event-dispatcher: 0.7.5 
enqueue/enqueue: 0.7.9
enqueue/enqueue-bundle: 0.7.8
enqueue/redis: 0.7.7

Activity

  1. makasim commented on Sep 5, 2017

    @makasim
    Member

    There is no such option yet. Here's a solution we made for dbal transport. It might work for redis too.

    https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/dbal/DbalConsumer.php#L96

  2. makasim commented on Sep 5, 2017

    @makasim
    Member

    The other solution: Add the third argument to queue consumer which is idle time. It could be a DI parameter with a default value set in the enqueue bundle, but there is a way to overwrite it from the app.

    https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue-bundle/Resources/config/client.yml#L82

  3. makasim commented on Sep 11, 2017

    @makasim
    Member

    There is --receive-timeout option is available since 0.7.11. You can use it to increase time a consumer waits on a socket for a message.

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