Bailey Kocin
04/02/2026, 3:52 PMRocky
04/02/2026, 3:53 PMstorage_root_path for the Data Cache. This is controlled by the BE configuration starlet_star_cache_disk_size_percent.
* Minimum Recommendation: If your hot data is small, even a few hundred GBs per node can significantly boost performance. If your hot data is massive (e.g., several TBs), you should consider using high-performance NVMe SSDs to handle the I/O throughput.
2. How to measure the balance?
The goal is to find a "sweet spot" where your cache hit ratio is high enough to satisfy performance requirements without over-investing in expensive local storage.
Key Metrics to Monitor
You can use the StarRocks BE API to check cache efficiency:
http://${BE_HOST}:${BE_HTTP_PORT}/api/datacache/app_stat
Metric | Goal | Meaning
block_cache_hit_rate | 80%| A high hit rate indicates most queries are served from local disk.
block_cache_disk_used_rate | ~80% | The cache naturally fills up to its limit (default 80%) and then evicts data.
fslib read io_latency | Low (ms) | Measures the latency of reading from the cache. High latency suggests disk I/O saturation.
Balancing Strategies
1. Identify Thrashing: If block_cache_hit_rate is consistently low (e.g., < 50%) while block_cache_disk_used_rate is at its limit, your cache is likely "thrashing" (new data constantly evicting useful data). You should increase the disk size.
2. Diminishing Returns: If increasing the cache size from 1TB to 2TB only improves the hit rate by 1-2%, you have likely reached the point of diminishing returns.
3. Storage Medium: If hit rates are high but query latency is still high, the bottleneck might be the disk speed rather than the size. Switching from HDD to NVMe SSD or increasing the number of disks to share I/O pressure is recommended.
4. Warmup Usage: Use the CACHE SELECT command (introduced in v3.3.0) to proactively load important tables into the cache, ensuring high hit rates for critical reports regardless of the overall cache size balance.
Configuration Parameters
* starlet_star_cache_disk_size_percent: The percentage of disk capacity Data Cache can use (Default: 80).
* datacache_disk_size: A fixed size (e.g., 2T) for the cache. The system takes the greater of this and the percentage setting.
* datacache.partition_duration: (Table property) Can be used to prioritize caching for more recent data partitions.
References
• using_starrocks/caching/block_cache.md
• data_source/data_cache_troubleshooting.md
• data_source/data_cache.md
• deployment/shared_data/feature-support-shared-data.mdBailey Kocin
04/02/2026, 4:05 PM{
"block_cache_hit_bytes": 0,
"block_cache_miss_bytes": 2010129650706,
"block_cache_hit_rate": 0.0,
"block_cache_hit_bytes_last_minute": 0,
"block_cache_miss_bytes_last_minute": 2622601322,
"block_cache_hit_rate_last_minute": 0.0,
"page_cache_hit_count": 5428897,
"page_cache_miss_count": 40393782,
"page_cache_hit_rate": 0.12,
"page_cache_hit_count_last_minute": 15492,
"page_cache_miss_count_last_minute": 42274,
"page_cache_hit_rate_last_minute": 0.27
}
{
"block_cache_hit_bytes": 0,
"block_cache_miss_bytes": 2054641467293,
"block_cache_hit_rate": 0.0,
"block_cache_hit_bytes_last_minute": 0,
"block_cache_miss_bytes_last_minute": 2295079659,
"block_cache_hit_rate_last_minute": 0.0,
"page_cache_hit_count": 5674182,
"page_cache_miss_count": 41121389,
"page_cache_hit_rate": 0.12,
"page_cache_hit_count_last_minute": 16361,
"page_cache_miss_count_last_minute": 39938,
"page_cache_hit_rate_last_minute": 0.29
}
{
"block_cache_hit_bytes": 0,
"block_cache_miss_bytes": 2165121857589,
"block_cache_hit_rate": 0.0,
"block_cache_hit_bytes_last_minute": 0,
"block_cache_miss_bytes_last_minute": 3262243755,
"block_cache_hit_rate_last_minute": 0.0,
"page_cache_hit_count": 6170005,
"page_cache_miss_count": 42928742,
"page_cache_hit_rate": 0.13,
"page_cache_hit_count_last_minute": 20356,
"page_cache_miss_count_last_minute": 48063,
"page_cache_hit_rate_last_minute": 0.3
}
This does not look great as the block cache is almost not being used?Rocky
04/02/2026, 4:05 PMSELECT *).
* Full Partition Scans: Your query does not include partition filters and scans all partitions.
* Non-Select Statements: Commands like INSERT INTO SELECT or ANALYZE TABLE do not populate the cache.
Solution: Try running a query with a specific WHERE clause on a partition key and selecting only a few columns to see if block_cache_hit_bytes starts to increase.
2. Verify CN Configuration
The Block Cache requires local disk space to be explicitly assigned on your Compute Nodes (CN). Check your cn.conf for the following:
* storage_root_path: This must be set to a valid local directory where the cache files will be stored.
* datacache_enable: Ensure this is true (default is true).
* datacache_disk_size: Ensure this is set to a value greater than 0 (e.g., 214748364800 for 200GB). If this is not set, the cache may not have space to write.
You can verify these at runtime by running:
sql
SELECT * FROM information_schema.be_configs
WHERE NAME LIKE "%storage_root_path%"
OR NAME LIKE "%datacache_disk_size%"
OR NAME LIKE "%datacache_enable%";
3. Check the Data Cache Status API
You can get more granular details (like whether writes are failing) by hitting the debug endpoint on one of your CN nodes:
bash
curl http://<CN_IP>:<CN_HTTP_PORT>/api/datacache/stat
Look for:
* `block_cache_status`: It should be NORMAL.
* `block_cache_write_fail_count`: If this is high, it indicates the system is trying to cache data but failing (likely due to disk permissions or lack of space).
* `block_cache_disk_used_bytes`: Check if this is growing at all.
4. Session Variables
Ensure that the session variable enable_scan_datacache is set to true (it is by default). You can check it with:
sql
SHOW VARIABLES LIKE '%enable_scan_datacache%';
5. Query Profile Analysis
To confirm exactly what is happening during a query, run a query and check its Profile:
sql
-- Run your query
SELECT col FROM your_table WHERE partition_col = 'xxx';
-- Get the profile ID
get_last_query_info();
Look for the DataCacheReadBytes and DataCacheWriteBytes metrics in the profile. If DataCacheWriteBytes is 0, it confirms the query is bypassing the cache population logic.
Rocky's Tip: If you are on a version >= 3.3.2 and need to force population for a full scan, you might need to adjust your query patterns or check if specific session variables like datacache_populate_mode (if available in your version) are restricting population.
References
• data_source/data_cache.md
• using_starrocks/caching/block_cache.mdBailey Kocin
04/02/2026, 4:08 PMSELECT * FROM information_schema.be_configs WHERE NAME LIKE "%storage_root_path%" OR NAME LIKE "%datacache_disk_size%" OR NAME LIKE "%datacache_enable%";
+-------+---------------------+---------------------------+--------+---------------------------+---------+
| BE_ID | NAME | VALUE | TYPE | DEFAULT | MUTABLE |
+-------+---------------------+---------------------------+--------+---------------------------+---------+
| 47034 | datacache_disk_size | 80% | string | 100% | 1 |
| 47034 | datacache_enable | true | bool | true | 0 |
| 47034 | storage_root_path | /opt/starrocks/cn/storage | string | ${STARROCKS_HOME}/storage | 0 |
| 29058 | datacache_disk_size | 80% | string | 100% | 1 |
| 29058 | datacache_enable | true | bool | true | 0 |
| 29058 | storage_root_path | /opt/starrocks/cn/storage | string | ${STARROCKS_HOME}/storage | 0 |
| 47014 | datacache_disk_size | 80% | string | 100% | 1 |
| 47014 | datacache_enable | true | bool | true | 0 |
| 47014 | storage_root_path | /opt/starrocks/cn/storage | string | ${STARROCKS_HOME}/storage | 0 |
+-------+---------------------+---------------------------+--------+---------------------------+---------+
Datacache
{
"page_cache_mem_quota_bytes": 19713899888,
"page_cache_mem_used_bytes": 19712283222,
"page_cache_mem_used_rate": 1.0,
"page_cache_hit_count": 5496031,
"page_cache_miss_count": 40606211,
"page_cache_hit_rate": 0.12,
"page_cache_hit_count_last_minute": 8601,
"page_cache_miss_count_last_minute": 28968,
"page_cache_hit_rate_last_minute": 0.23,
"block_cache_status": "NORMAL",
"block_cache_disk_quota_bytes": 3457448673280,
"block_cache_disk_used_bytes": 3457108934656,
"block_cache_disk_used_rate": 1.0,
"block_cache_disk_spaces": "/opt/starrocks/cn/storage/datacache:3457448673280",
"block_cache_meta_used_bytes": 2143356235,
"block_cache_hit_count": 145446986,
"block_cache_miss_count": 1201127,
"block_cache_hit_rate": 0.99,
"block_cache_hit_bytes": 4639948636097,
"block_cache_miss_bytes": 209996974364,
"block_cache_hit_count_last_minute": 175969,
"block_cache_miss_count_last_minute": 1377,
"block_cache_hit_bytes_last_minute": 8614902679,
"block_cache_miss_bytes_last_minute": 274681355,
"block_cache_read_disk_bytes": 4639919169822,
"block_cache_write_bytes": 1729893934440,
"block_cache_write_success_count": 2130741,
"block_cache_write_fail_count": 0,
"block_cache_remove_bytes": 0,
"block_cache_remove_success_count": 274100,
"block_cache_remove_fail_count": 0,
"block_cache_current_reading_count": 0,
"block_cache_current_writing_count": 0,
"block_cache_current_removing_count": 0
}
{
"page_cache_mem_quota_bytes": 19713899888,
"page_cache_mem_used_bytes": 19712728739,
"page_cache_mem_used_rate": 1.0,
"page_cache_hit_count": 5729122,
"page_cache_miss_count": 41304319,
"page_cache_hit_rate": 0.12,
"page_cache_hit_count_last_minute": 7464,
"page_cache_miss_count_last_minute": 28822,
"page_cache_hit_rate_last_minute": 0.21,
"block_cache_status": "NORMAL",
"block_cache_disk_quota_bytes": 3489660928000,
"block_cache_disk_used_bytes": 2428896018432,
"block_cache_disk_used_rate": 0.7,
"block_cache_disk_spaces": "/opt/starrocks/cn/storage/datacache:3489660928000",
"block_cache_meta_used_bytes": 1531683800,
"block_cache_hit_count": 146077600,
"block_cache_miss_count": 1373841,
"block_cache_hit_rate": 0.99,
"block_cache_hit_bytes": 4624154839431,
"block_cache_miss_bytes": 227551097778,
"block_cache_hit_count_last_minute": 175167,
"block_cache_miss_count_last_minute": 1101,
"block_cache_hit_bytes_last_minute": 8601983006,
"block_cache_miss_bytes_last_minute": 239384615,
"block_cache_read_disk_bytes": 4624125595192,
"block_cache_write_bytes": 1557336197699,
"block_cache_write_success_count": 1941092,
"block_cache_write_fail_count": 716,
"block_cache_remove_bytes": 0,
"block_cache_remove_success_count": 260878,
"block_cache_remove_fail_count": 0,
"block_cache_current_reading_count": 0,
"block_cache_current_writing_count": 0,
"block_cache_current_removing_count": 0
}
{
"page_cache_mem_quota_bytes": 19713899888,
"page_cache_mem_used_bytes": 19710451400,
"page_cache_mem_used_rate": 1.0,
"page_cache_hit_count": 6231185,
"page_cache_miss_count": 43098843,
"page_cache_hit_rate": 0.13,
"page_cache_hit_count_last_minute": 8958,
"page_cache_miss_count_last_minute": 31065,
"page_cache_hit_rate_last_minute": 0.22,
"block_cache_status": "NORMAL",
"block_cache_disk_quota_bytes": 3457448673280,
"block_cache_disk_used_bytes": 3457448148992,
"block_cache_disk_used_rate": 1.0,
"block_cache_disk_spaces": "/opt/starrocks/cn/storage/datacache:3457448673280",
"block_cache_meta_used_bytes": 2140548296,
"block_cache_hit_count": 147202574,
"block_cache_miss_count": 1358228,
"block_cache_hit_rate": 0.99,
"block_cache_hit_bytes": 4643244119539,
"block_cache_miss_bytes": 233765852135,
"block_cache_hit_count_last_minute": 174778,
"block_cache_miss_count_last_minute": 1245,
"block_cache_hit_bytes_last_minute": 8605737752,
"block_cache_miss_bytes_last_minute": 297297754,
"block_cache_read_disk_bytes": 4643215418894,
"block_cache_write_bytes": 1929037782116,
"block_cache_write_success_count": 2297835,
"block_cache_write_fail_count": 0,
"block_cache_remove_bytes": 0,
"block_cache_remove_success_count": 249429,
"block_cache_remove_fail_count": 0,
"block_cache_current_reading_count": 0,
"block_cache_current_writing_count": 0,
"block_cache_current_removing_count": 0
}
SHOW VARIABLES LIKE '%enable_scan_datacache%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| enable_scan_datacache | true |
+-----------------------+-------+Rocky
04/02/2026, 4:09 PMblock_cache_disk_used_rate of 1.0 (100%). For a cache, being full is normal and expected behavior; it means the allocated 80% of your disk space is fully utilized, and StarRocks is using an LRU (Least Recently Used) policy to manage space.
3. Potential Issue on BE 29058:
* This node is only at 70% usage, while others are at 100%.
* Crucially, it shows block_cache_write_fail_count: 716, whereas the other nodes have 0 failures.
* Recommendation: Check the BE logs (<http://be.INFO|be.INFO> or be.WARNING) for this specific node. This failure often indicates underlying disk I/O issues, permission problems, or the physical disk becoming full before the logical cache quota was reached.
Metric Breakdown
* Block Cache (Disk-based):
* Hit Rate (99%): Exceptional. You are getting maximum value from your SSDs/disks.
* Disk Quota: You have roughly 3.2 TiB allocated per node for caching (block_cache_disk_quota_bytes).
* Page Cache (Memory-based):
* Used Rate (1.0): Your memory-based page cache is also fully utilized.
* Hit Rate (12-13%): This is lower than the block cache, which is common if your "hot" working set is larger than the available memory but fits well within the disk cache.
* Configuration:
* datacache_enable = true and enable_scan_datacache = true are correctly configured for the cluster and the session.
Suggestions
* Investigate BE 29058: Look for strings like DataCache or st_write in the logs of BE 29058 to understand why those 716 writes failed.
* Monitor Disk Latency: Since your hit rate is so high, the performance of your queries is now heavily dependent on the I/O latency of the path /opt/starrocks/cn/storage/datacache. Ensure these are high-performance SSDs (NVMe preferred) for the best results.
Do you have a specific performance issue you are troubleshooting, or were you just checking the health of the cache?
References
• data_source/data_cache_observe.md
• using_starrocks/caching/block_cache.mdBailey Kocin
04/02/2026, 4:11 PMRocky
04/02/2026, 4:11 PMdatacache_disk_size configuration to set a specific limit (e.g., 500G, 1T). This can be done dynamically without a restart:
sql
-- Adjust the disk limit for all BE nodes
UPDATE be_configs SET VALUE="500G" WHERE NAME="datacache_disk_size";
-- Or for a specific BE node
UPDATE be_configs SET VALUE="500G" WHERE NAME="datacache_disk_size" AND BE_ID=10005;
Note: Changes made via UPDATE be_configs are not persistent. To make them permanent, you must also update the be.conf or cn.conf file on each node.
2. Physically Reclaiming Space
A common point of confusion is that StarRocks does not always delete the physical files on disk immediately when data is evicted; it often marks that space as "overwritable" to maintain performance. If you see that your disk usage remains high even after reducing the quota, you can force a cleanup:
* Option A: The "Zero Out" Trick (No restart required)
Set the quota to 0 to trigger a cleanup, and then set it back to your desired size:
sql
UPDATE be_configs SET VALUE="0" WHERE NAME="datacache_disk_size";
-- Wait a moment for the system to process
UPDATE be_configs SET VALUE="500G" WHERE NAME="datacache_disk_size";
* Option B: Manual Cleanup (Restart required)
1. Stop the BE/CN node.
2. Delete the contents of the datacache directory (found under your storage_root_path).
3. Restart the node.
3. Automatic Scaling
If you prefer the system to manage this automatically based on disk pressure, you can enable auto-adjustment in your configuration:
properties
datacache_auto_adjust_enable = true
With this enabled, the system will evict cache data when the disk usage reaches disk_high_level (default 90%) and aim to keep it around disk_safe_level (default 80%).
Important Configurations to Check:
* datacache_disk_size: The absolute disk quota (e.g., 200G).
* starlet_star_cache_disk_size_percent: The percentage of the disk to use for cache (default is often 80%). The system usually takes the greater of these two values.
References
• data_source/data_cache_troubleshooting.md
• using_starrocks/caching/block_cache.md
• data_source/data_cache.md
• knowledge/usage/best-practice.mdBailey Kocin
04/02/2026, 4:12 PMRocky
04/02/2026, 4:12 PMstorage_root_path or log directories happen to point to the same disk partition, they will compete for space. If the cache takes 100%, the node might crash when it tries to write a log or a core dump.
2. The 80% Default and Eviction
StarRocks' Data Cache is designed to be an LRU (Least Recently Used) cache. It doesn't actually delete files to free up space; it marks old data as overwritable once the limit is reached.
* Default Behavior: By default, StarRocks targets 80% usage.
* Observation: You might notice that even with an 80% limit, the actual OS-level disk usage (reported by df -h) might look higher (e.g., 85-90%) because of the way the cache manages peak historical usage.
3. Impact of the Separate Spill Disk
Having a separate spill disk is an excellent practice. It ensures that when a large query triggers a spill to disk, it doesn't:
1. Contend for I/O with the data cache.
2. Compete for space with the data cache.
Since your spill disk is separate, you can safely increase the cache limit from 80% to 90% if you want to maximize your cache hit rate, but avoid 100%.
Recommended Action
If you want to squeeze more performance out of your dedicated cache disk, you can update the configuration to 90%.
You can do this dynamically for the BE/CN nodes using:
sql
-- Replace <BE_ID> with your actual Backend ID
UPDATE be_configs SET VALUE="90" WHERE NAME="starlet_star_cache_disk_size_percent" AND BE_ID=<BE_ID>;
Summary Checklist:
* 80-90%: Safe and recommended.
* 95%+: Risky; may lead to filesystem fragmentation or "No space left on device" errors for system tasks.
* Separate Spill Disk: Keep this as is—it’s the best way to prevent spill-heavy queries from killing your cache performance.
References
• using_starrocks/caching/block_cache.md
• administration/management/resource_management/spill_to_disk.md
• data_source/data_cache_troubleshooting.md