---
title: "Streaming events with RingBuf"
---

> Documentation Index
> Fetch the complete documentation index at: https://example.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Streaming events with RingBuf

Counters fit maps, but captured packets and trace events must stream to user space. [BPF RingBuf](https://example.com/ebpf-field-guide/glossary/#bpf-ringbuf) (`BPF_MAP_TYPE_RINGBUF`) is a single multi-producer, single-consumer circular buffer shared across CPUs.

Unlike the older `PERF_EVENT_ARRAY` (one ring per CPU, out-of-order events, wasted RAM), RingBuf preserves global timestamp order and lets hooks write directly via `bpf_ringbuf_reserve()` without an extra stack copy.

## What changed

- Per-CPU perf rings → one shared memory-mapped ring
- Out-of-order merge → strict cross-CPU event order
- Stack copy → direct reserve & submit zero-copy

Source: https://example.com/ebpf-field-guide/core-architecture/maps-and-data/ringbuf/index.mdx
