RabbitMQ consumer and producer are in the same process, the consumption speed will be affected.

problem description

there are two queues, route_msg and async_db, bound to an exchange of type direct. The
program has a consumer thread (consumerA)
operation 1:
to get the message uploaded by the client from route_msg, after processing is complete.
Action 2:
sends the operations that need to write db asynchronously to the async_db queue.
Action 3:
at the same time, another consumer thread, (consumerB), consumes messages on async_db and stores them.

in the course of actual operation, I found that after commenting the code of operation 2 and 3, the consumer consumption speed of operation 1 was normal, but when I opened operation 2 and operation 3, the consumption speed of consumerA decreased significantly. The phenomenon is shown in the following figure, the first picture is only consuming route_msg, and the second picture is consuming both route_msg and async_db queues at the same time.

the environmental background of the problems and what methods you have tried

RabbitMQ and programs are all on the same centos 7 machine, and the network card is 100 megabytes.
look at the network traffic is normal, is the incorrect use of rabbitMQ?

related codes

/ / Please paste the code text below (do not replace the code with pictures)

   -sharp route_msg 
   def consumeMsg(body, message):
        self.msg_dispatch.dispatch(body) -sharp  async_db
        message.ack()

    -sharp  async_db 
    def consumeDBRequest(body, message):
        self.syncDB(body)
        message.ack()

what result do you expect? What is the error message actually seen?

 route_msg  
 async_db  python ?
Aug.06,2021
Menu