This topic describes the connection and channel concepts in ApsaraMQ for RabbitMQ and provides some suggestions on their usage.


A connection refers to a physical Transmission Control Protocol (TCP) connection. Connections are established between applications and ApsaraMQ for RabbitMQ. Connections can be used to support underlying network tasks, such as authentication, IP address resolution, and routing. The establishment of a connection between an application and ApsaraMQ for RabbitMQ requires about 15 TCP packets for interaction, which consume a large number of network resources and ApsaraMQ for RabbitMQ resources. A large number of connections may cause great pressure on ApsaraMQ for RabbitMQ or even trigger protection against SYN flood attacks. In this case, ApsaraMQ for RabbitMQ may fail to respond, and your business is affected.



A channel refers to a virtual connection that is established based on a physical TCP connection. All AMQP-based operations are performed over the channels of a connection between an application and ApsaraMQ for RabbitMQ. For example, queues are created over channels, and messages are sent and received over channels. Each connection can have multiple channels. Channels are dependent on connections. After a connection is closed, all the channels of the connection are also closed. If you need to connect a large number of applications to ApsaraMQ for RabbitMQ, we recommend that you establish multiple channels for one connection instead of establishing a large number of connections. This reduces the usage of network resources and ApsaraMQ for RabbitMQ resources.


Usage suggestions

Pay attention to the following suggestions on the usage of connections and channels:

  • Use persistent connections. Do not frequently open or close a connection. You can frequently open or close a channel. For more information about the limits on the interfaces that are used to open connections and channels on a single instance, see Limits.
  • Each process corresponds to a connection, and the threads of a process have a one-to-one mapping onto the channels of a connection.
  • Producers and consumers use different connections to send and consume messages.