mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
This commit adds lib/chunkedbuffer.Buffer - an in-memory chunked buffer optimized for random access via MustReadAt() function. It is better than bytesutil.ByteBuffer for storing large volumes of data, since it stores the data in chunks of a fixed size (4KiB at the moment) instead of using a contiguous memory region. This has the following benefits over bytesutil.ByteBuffer: - reduced memory fragmentation - reduced memory re-allocations when new data is written to the buffer - reduced memory usage, since the allocated chunks can be re-used by other Buffer instances after Buffer.Reset() call Performance tests show up to 2x memory reduction for VictoriaLogs when ingesting logs with big number of fields (aka wide events) under high speed.