starrocks-memory-tuning

Tune StarRocks memory limits, spill settings, and pool configurations to resolve query OOM and BE memory pressure.

14|1|Updated May 5, 2026
One-click install
npx skills add https://github.com/ivanshamaev/de-agent-skills --skill starrocks-memory-tuning
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: starrocks-memory-tuning
Source: https://github.com/ivanshamaev/de-agent-skills/tree/main/group_skills/starrocks_group_skills/starrocks_memory_tuning
Command: npx skills add https://github.com/ivanshamaev/de-agent-skills --skill starrocks-memory-tuning

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose and fix StarRocks memory pressure that leads to query OOM failures, BE crashes, slow performance, and unstable loads by tuning the BE memory pools, spill behavior, and FE heap settings.

Core Features & Use Cases

  • Query and BE memory limit tuning: Adjusts mem_limit, per-query query_mem_limit, and resource-group mem_limit to match workload needs and prevent MemoryLimitExceeded.
  • Controlled memory spill to disk: Enables and sizes spill (spill_mode, spill thresholds, spill directories, and per-query spill caps) so large joins/aggregations/sorts can finish instead of failing.
  • Pool-level footprint optimization: Tunes page cache (storage_page_cache_limit), PK persistent index cache (primary_key_index_cache_capacity), and allocator behavior (jemalloc) to reduce wasted RAM and fragmentation.
  • Production-grade troubleshooting workflow: Guides you through OOM log inspection, mem_tracker hierarchy review, metrics queries, and Linux OOM-killer checks to pinpoint the dominant memory consumer.
  • Monitoring and alerting: Recommends Prometheus alert thresholds and dashboards based on StarRocks BE memory metrics to catch regressions early.

Example use: a BI workload intermittently fails with MemoryLimitExceeded during heavy aggregations while BE RSS climbs near the limit; you can enable spill, raise per-query caps appropriately, and reduce page cache to free headroom.

Quick Start

Diagnose the failing query by setting per-session query_mem_limit to 16 GB and enabling spill_mode='auto', then rerun the workload and confirm the dominant memory pool via BE mem_tracker and memory metrics.

Frequently Asked Questions about starrocks-memory-tuning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix StarRocks query OOM and MemoryLimitExceeded errors?

Fix StarRocks query OOM by tuning BE mem_limit, per-query query_mem_limit, and resource-group mem_limit. You can also enable spill_mode='auto' so large joins, aggregations, and sorts spill to disk instead of failing with MemoryLimitExceeded.

Why does my StarRocks BE crash with an OOM and high memory pressure?

StarRocks BE crashes from OOM when memory limits are exceeded by query, load, compaction, or caching pools. Diagnose the dominant memory consumer by inspecting be.out logs, reviewing the mem_tracker hierarchy, and checking Linux OOM-killer events.

How do I tune StarRocks memory pools to reduce BE RSS and fragmentation?

Tune StarRocks memory pools by adjusting storage_page_cache_limit and primary_key_index_cache_capacity to free headroom. Modify allocator behavior using jemalloc settings to reduce wasted RAM and memory fragmentation within the BE process.

What is the best way to configure StarRocks spill to disk for heavy aggregations?

Configure StarRocks spill to disk by setting spill_mode, configuring spill thresholds, defining spill directories, and applying per-query spill caps. This allows heavy aggregations to finish successfully by writing intermediate data to disk when memory is exhausted.

How do I set up Prometheus alerts for StarRocks BE memory metrics?

Set up Prometheus alerts for StarRocks BE memory by defining alert thresholds based on BE memory metrics, RSS utilization, and mem_tracker limits. Validate outcomes and catch regressions early using dashboards built from information_schema and metrics queries.

Do I need to adjust FE JVM heap settings when right-sizing StarRocks memory?

Yes, right-sizing StarRocks memory requires adjusting FE JVM heap settings alongside BE memory limits. This ensures both Frontend metadata operations and Backend query processing have sufficient memory allocated for new clusters or workload changes.