<@U0A71G31CDV> How to disable caching in Compute N...
# questions-and-troubleshooting
r
@Rocky How to disable caching in Compute Nodes deployed in K8s.
r
To disable caching in Compute Nodes (CN) deployed on Kubernetes, you need to update the CN configuration within your
StarRocksCluster
custom resource (CR) or your Helm chart
values.yaml
. 1. Key Configuration Parameters To fully disable the Data Cache (which includes both block and page cache), you must set the following parameters in the `cn.conf`: * `datacache_enable`: Set to
false
. * `storage_root_path`: Leave this empty or remove the cache path if it was previously defined. *
starlet_use_star_cache
(for shared-data clusters): Set to
false
. 2. Implementation in K8s (using Operator/YAML) If you are using the StarRocks Operator, you should modify your
StarRocksCluster
YAML file under the
starRocksCnSpec.config
section:
Copy code
yaml
apiVersion: <http://starrocks.com/v1|starrocks.com/v1>
kind: StarRocksCluster
metadata:
  name: starrockscluster-sample
spec:
  starRocksCnSpec:
    config: |
      datacache_enable = false
      storage_root_path = 
      starlet_use_star_cache = false
    # ... other CN specs like image, replicas, etc.
3. Implementation via Helm Chart If you are deploying via the Helm chart, update your `values.yaml`:
Copy code
yaml
starrocksCnSpec:
  config: |
    datacache_enable = false
    storage_root_path = 
    starlet_use_star_cache = false
4. Apply the Changes After updating the YAML file, apply the changes to your Kubernetes cluster:
Copy code
bash
kubectl apply -f your-cluster-config.yaml
The StarRocks Operator will perform a rolling restart of the CN pods to apply the new configuration. Alternative: Disable per Session If you want to disable the cache for a specific session or query without restarting the nodes, you can use a system variable:
Copy code
sql
SET enable_scan_datacache = false;
Or globally (though this doesn't stop the cache background processes, it stops queries from using it):
Copy code
sql
SET GLOBAL enable_scan_datacache = false;
Note: Disabling
datacache_enable
is the most effective way to ensure no disk or memory resources are allocated for caching on the CN nodes. Referencesusing_starrocks/caching/block_cache.mdsql-reference/System_variable.mddata_source/data_cache.mdadministration/management/BE_configuration.mddeployment/shared_data/feature-support-shared-data.md
r
@Rocky I set only these two values in cn: datacache_enable = false disable_storage_page_cache = true
r
By setting
datacache_enable = false
and
disable_storage_page_cache = true
on your Compute Node (CN), you have effectively disabled all major data caching mechanisms. Here is what this means for your StarRocks cluster: 1. What these settings do *
datacache_enable = false
: This disables the Data Cache (also known as Block Cache). In a CN or shared-data architecture, this cache is responsible for storing data blocks from remote storage (like S3, HDFS, or OSS) on the CN's local disk or memory. Disabling it means every query must fetch raw data from the remote storage every time. *
disable_storage_page_cache = true
: This disables the Page Cache, which typically stores decompressed and decrypted data pages in the CN's memory. This cache is used to accelerate repeated access to the same data pages. 2. The Impact on Performance * Increased Latency: Since no data is stored locally, every query will incur the network latency of fetching data from remote storage. Even for the exact same query run twice, the second run will be just as slow as the first because no "hot" data is retained. * High Remote I/O: You will see significantly higher I/O and bandwidth usage on your object storage or HDFS. * Lower Throughput: The system's overall capacity to handle concurrent queries will decrease because the compute resources will often be waiting for data to arrive from the network. 3. When is this configuration used? Usually, these are set to `false`/`true` (disabled) only in specific scenarios: * Debugging/Testing: When you want to measure the "cold start" performance or the raw speed of your remote storage/network. * Extremely Memory/Disk Constrained Environments: If the CN has almost no local disk space for cache and very limited RAM, though this is generally not recommended for production. * Ad-hoc queries on massive datasets: If your workload has zero data locality (you never query the same data twice), caching might provide less benefit, but even then, it is usually better to leave it enabled for metadata and common headers. Redundancy Note According to StarRocks documentation,
datacache_enable = false
is a global switch that typically disables both the Page Cache and the Block Cache for remote data access. By setting both, you are ensuring that no caching occurs at any level. Recommendation: If this is a production environment, it is highly recommended to enable these (especially
datacache_enable
) to take advantage of StarRocks' performance optimizations for shared-data architecture. If you're seeing high disk usage, it's better to tune the
datacache_disk_size
rather than disabling the feature entirely.
k
just out of curosity, why you want to disable it ?
r
to evaluate query execution behaviour under cache-miss conditions