Skip to content

Redis consumer has very high resource usage #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JunkMyFunk opened this issue Sep 5, 2017 · 3 comments · Fixed by #193
Closed

Redis consumer has very high resource usage #191

JunkMyFunk opened this issue Sep 5, 2017 · 3 comments · Fixed by #193
Labels

Comments

@JunkMyFunk
Copy link

JunkMyFunk commented Sep 5, 2017

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
@makasim
Copy link
Member

makasim commented Sep 5, 2017

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

@makasim makasim added the bug label Sep 5, 2017
@makasim
Copy link
Member

makasim commented Sep 5, 2017

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

@makasim
Copy link
Member

makasim commented Sep 11, 2017

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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants