weixin_39600319 2020-11-29 23:16
浏览 0

[RabbitMQ] High resource usage in AmqpConsumer::receiveBasicGet()

TLDR recieveBasicGet() (the default receive method) is using a lot of CPU and other resources as it's calling AMQPQueue::get() as fast as it can, unbound. Should be able to switch receive method to consume and/or fix this one.

~~I'm switching my Dockerized app from using php:7.1-alpine to alpine:3.6 and installing php7* packages required (Dockerfile), Alpine now supports PHP 7.1 and it should make my process somewhat more streamlined.~~

~~Problem is, Enqueue seems to work WAY worse in the new environment. What I mean is, resource usage goes through the roof as soon as I start a consumer (note, there are no messages produced or consumed here, it's just idle wait). When using RabbitMQ's web management console, I see my consumer's connection doing 500KB/s traffic (as I said, no messages produced, it's waiting for something to happen).~~

~~I cannot quite pinpoint why this happens as the PHP version is the same, PHP modules are the same, codebase (including Enqueue) is exactly the same, etc. Obviously, this means I shouldn't report this bug here. :)~~

~~What does stand out is the code in recieveBasicGet(), it's basically calling a non-blocking AMQPQueue::get() without any restrictions. I'm guessing this is the core cause of this problem as I'm able to avoid this completely if I add usleep(10000) to recieveBasicGet() or switch the receive method to basic_consume (both of which I'm unable to do without changing the vendor source).~~

该提问来源于开源项目:php-enqueue/enqueue-dev

  • 写回答

2条回答 默认 最新

  • weixin_39600319 2020-11-29 23:16
    关注

    Sorry, just realized I'm wrong: I'm using enqueue/amqp-ext 0.4.11 in the original branch, but 0.4.13 in my new branch, this is then a regression, I'd say. AmqpConsumer::receive() looks way different between those versions.

    评论

报告相同问题?