---
title: Message queues
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/message-queues
---

The New Relic Ruby agent supports the [Bunny RabbitMQ client library](https://rubygems.org/gems/bunny), giving you insight into the performance of your message processing, for both incoming and outgoing messages.

The APM UI shows transactions initiated via RabbitMQ message receipt (subscribe/consume messages) as **Message** background tasks. Message creation via RabbitMQ also appears in transaction traces.

## Requirements

Requires New Relic [Ruby agent version 4.3.0 or higher](https://docs.newrelic.com/docs/release-notes/agent-release-notes/ruby-release-notes). Instrumentation is automatic for [supported versions of Bunny AMQP](https://docs.newrelic.com/docs/agents/ruby-agent/getting-started/ruby-agent-requirements-supported-frameworks#other), and requires no additional configuration.

## Performance improvements with background tasks [#background]

One way to increase responsiveness of web applications is to delegate work to background processes. Message queues are commonly used for this inter-process communication.

In the context of message queuing systems, applications typically interact with message brokers to send and receive messages. The RabbitMQ Bunny client library allows Ruby applications to interface with message brokers that implement the Advanced Message Queuing Protocol (AMQP).

New Relic's Ruby agent shows messages sent and received using the RabbitMQ client library. With this visibility, you can see details including:

-   Number of messages produced by your app
-   Time your app spends publishing messages
-   Time your app spends processing "consumed" messages

[APM](#view-queue) conveniently groups and reports operations that interact with queues. By analyzing this information, you can more easily identify bottlenecks and areas for performance improvement in your message passing architecture.

## Queue operations [#queue-ops]

Supported entry points for queue operations appear as `Put` (publish a message) or `Take` (receive a message) in APM's user interface.

| **Queue operations** | **Publish a message (`Put` in UI)** | **Receive a message (`Take` in UI)** |
| -------------------- | ----------------------------------- | ------------------------------------ |
| RabbitMQ             | `publish`                           | `pop` `subscribe (with block)`       |

## View in New Relic UI [#view-queue]

Message queue operations are visible in several places in the APM UI:

**Transactions page**

Queue operations appear on APM's [**Transactions** page](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-dashboard) for the selected app. The `Put` and `Take` metrics appear in the **Breakdown table** and are categorized as `MessageBroker` metrics. Here is an example:

![transactions_page.png](https://docs.newrelic.com/images/apm_screenshot-full_transactions-overview.webp "transactions_page.png")

[Transaction traces](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces) also provide additional details for messages.

> #### 💡 TIP
>
> You can [select transaction traces](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/viewing-transaction-traces) from the app's **Summary** or **Transactions** pages in APM.

**Transaction trace summary page**

The [**Transaction trace summary** page](https://docs.newrelic.com/docs/apm/transactions/transaction-traces/transaction-traces-trace-details-page) may show `Put` and `Take` operations in the **Slowest components** section. For example:

![trace_summary.png](https://docs.newrelic.com/images/apm_screenshot-full_trace-summary.webp "trace_summary.png")

**Transaction trace details tab**

The **Transaction trace** page includes a dedicated **Details** tab that shows more detailed information about the transaction. Here is an example:

![trace_details.png](https://docs.newrelic.com/images/apm_screenshot-full_trace-details.webp "trace_details.png")
