Logo Import

Import

Tổ chức
StarRocks
import

Use when import jobs are slow, timing out, or failing — Stream Load, Broker Load, Routine Load, INSERT INTO, Flink connector. Covers write-slow triage (async_delta_writer / memtable_flush / segment_replicate_sync thread pools), publish timeout on PK tables, RPC Failed errors, Reached timeout auto-diagnostics (v3.4+), and load profile analysis. Also covers read-slow causes and Kafka partition bottlenecks.

Add to TypingMind

Tổng quan

Nhà phát hànhStarRocks
Kho mãstarrocks-debug-skills
Tên kỹ năngimport
Sao
78
Bản fork
14
Tệp đi kèm
6
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 6 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được StarRocks công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Import trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/StarRocks/starrocks-debug-skills/tree/main/import
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/StarRocks/starrocks-debug-skills.git /tmp/starrocks-debug-skills
mkdir -p .claude/skills
cp -r /tmp/starrocks-debug-skills/import .claude/skills/import
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Import trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Import ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Import với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Import Troubleshooting

Investigation guide for import slowness, timeouts, RPC failures, publish timeouts, Primary Key model tuning, and load profile analysis.

Six root causes account for the vast majority of cases:

  • Cause A — Write slow: thread pool bottleneck (async_delta_writer / memtable_flush saturated)
  • Cause B — Write slow: BRPC / network issue (connection backlog, packet loss)
  • Cause C — Write slow: PK index rebuild during clone / decommission
  • Cause D — Publish timeout: compaction lag on PK table
  • Cause E — Read slow: source-side bottleneck (Kafka partition count, file IO, HTTP client)
  • Cause F — RPC Failed: statistics collection conflict saturating BRPC

Metric Taxonomy — Read This First

Before using any metrics, understand the write pipeline and where each metric fits:

Thread pool metrics (BE-side, per-node)

PoolMetricsMeaning
async_delta_writerpendingQueue wait time — high = pool size insufficient
async_delta_writerexecuteTask execution time — contains wait_flush + wait_replica
async_delta_writerwait_flushWait for memtable flush — high → analyze memtable_flush pool
async_delta_writerwait_replicaWait for secondary replica sync — high → analyze segment_replicate
async_delta_writerpk_preloadPK index rebuild time — high → set skip_pk_preload = true
memtable_flushpendingQueue wait time
memtable_flushexecuteTotal flush time
memtable_flushioIO portion of flush — high = disk or S3 bottleneck
memtable_flushrateFlush rate (tasks/sec)
segment_replicate_syncpending / executeReplica sync queue wait and processing time
segment_flushpending / execute / ioSecondary disk flush metrics

BRPC metrics (BE-side, per interface)

MetricMeaning
total / usedTotal / in-use BRPC threads — if used ≈ total, BRPC is saturated
latency-avg / latency-99Interface latency — high P99 = server-side processing slow
Brpc Processing RequestsIn-flight RPC count — 0 during timeout = network or BRPC issue

Key interfaces: tablet_writer_open, tablet_writer_add_chunks, tablet_writer_add_segment

Import state metrics (FE-side, SQL)

Key fields from information_schema.loads:

FieldMeaning
STATEPENDING / BEGIN / LOADING / PREPARED / COMMITTED / FINISHED / CANCELLED
PROGRESSETL and LOADING phase progress percentage
SCAN_ROWS / SCAN_BYTESSource data read
SINK_ROWSRows successfully written
CREATE_TIME / LOAD_START_TIME / LOAD_COMMIT_TIME / LOAD_FINISH_TIMETimestamps for phase duration
ERROR_MSGError message (NULL if none)
PROFILE_IDProfile ID for ANALYZE PROFILE FROM 'profile_id'

How to retrieve metrics

Option 1 — BRPC metrics endpoint (per-BE)

bash
# View all import-related thread pool metrics
curl -s "http://<be_ip>:8060/vars" | grep -E "async_delta_writer|memtable_flush|segment_replicate|segment_flush"

# View BRPC thread utilization
curl -s "http://<be_ip>:8060/vars" | grep -E "brpc_worker|bthread|tablet_writer"

# Loop all BEs
for be in 10.0.0.1 10.0.0.2 10.0.0.3; do
  echo "=== $be ==="
  curl -s "http://$be:8060/vars" | grep -E "async_delta_writer_pending|async_delta_writer_execute|memtable_flush_io"
done

Option 2 — SQL (import state)

sql
-- All running and recent import tasks
SELECT ID, LABEL, STATE, TYPE, PROGRESS, SCAN_BYTES, SINK_ROWS,
       LOAD_START_TIME, LOAD_FINISH_TIME, ERROR_MSG
FROM information_schema.loads
WHERE STATE NOT IN ('FINISHED', 'CANCELLED')
ORDER BY CREATE_TIME DESC;

-- Historical import throughput by minute
SELECT date_trunc('minute', load_finish_time) AS t,
       count(*) AS tpm, sum(SCAN_BYTES) AS scan_bytes, sum(sink_rows) AS sink_rows
FROM _statistics_.loads_history
GROUP BY t ORDER BY t DESC LIMIT 10;

Option 3 — FE transaction log (write vs publish duration)

bash
# Find write vs publish duration by label or txn_id
grep "<label_or_txn_id>" fe.log | grep "finishTransaction"
# Log format: "write cost: 243ms ... publish total cost: 154ms"
# write cost >> publish cost → slow write phase (Cause A/B/C)
# publish cost >> write cost → slow publish phase (Cause D)

Option 4 — BE auto-diagnostic profile (v3.4+)

bash
# Reached timeout profile (v3.4+: auto-logged on timeout)
grep "profile=" be.WARNING
# Example: tablet writer add chunk timeout. txn_id=1691, cost=16728ms, timeout=16500ms, profile=xxx

# Stack trace (v3.5+)
grep "diagnose stack trace, id:" be.INFO
# Extract the id, then:
grep "DIAGNOSE <id> -" be.INFO > stack_trace.log

Key rules for interpretation:

  1. Start with the FE transaction log (finishTransaction) to split write cost vs publish cost — this tells you which phase to focus on.
  2. If async_delta_writer.pending is high, the pool is too small — increase number_tablet_writer_threads. If execute is high with pending low, the bottleneck is within the task (check wait_flush, wait_replica, pk_preload).
  3. If BRPC used ≈ total and Brpc Processing Requests is near-zero during a timeout, the BRPC layer itself is the bottleneck — not the storage layer.
  4. PK tables have an additional pk_preload sub-phase in async_delta_writer.execute — this alone can cause minutes-long write stalls during clone or decommission operations.

Import Slow Signal Reference

Signal / ErrorPoints to CausePhase
Timeout by txn managerCause A or E — write or read slowWrite or Read
[E1008]Reached timeoutCause A or B — storage write timeout (brpc between Coordinator and Executor)Write
publish timeoutCause D — PK compaction lagPublish
RPC Failed sending plan fragmentCause F — BRPC saturated by statistics collectionWrite setup
Routine Load task lag growsCause E — Kafka partition bottleneckRead
async_delta_writer.pending non-zero and growingCause A — thread pool exhaustedWrite
async_delta_writer.pk_preload highCause C — PK index rebuildWrite
memtable_flush.io ≈ memtable_flush.executeCause A — disk or S3 IO saturationWrite
BRPC used ≈ total, Processing Requests = 0Cause B — BRPC network saturationWrite
starrocks_be_publish_version_queue_count growingCause D — publish queue backlogPublish

Terminology

TermDefinition
Import JobContinuous import operations: Routine Load Job, Pipe Job
Import TaskOne-time import task corresponding to a transaction: Broker Load, Stream Load, Spark Load, Insert Into. Routine Load/Pipe internally generate continuous Import Tasks

Phase 1 — Confirm Import Is Behind

Step 1.1 — Check import state and timestamps

sql
-- Find slow / stuck imports
SELECT ID, LABEL, STATE, TYPE,
       TIMESTAMPDIFF(SECOND, LOAD_START_TIME, NOW()) AS elapsed_sec,
       PROGRESS, SCAN_BYTES, SINK_ROWS, ERROR_MSG
FROM information_schema.loads
WHERE STATE IN ('LOADING', 'PREPARED', 'COMMITED')
ORDER BY elapsed_sec DESC;

Step 1.2 — Determine which phase is slow

bash
# Split write vs publish duration
grep "<label_or_txn_id>" fe.log | grep "finishTransaction"
# "write cost: Xms ... publish total cost: Yms"
Phase timingNext step
write cost >> expectedPhase 2 (identify write bottleneck)
publish total cost >> expectedPhase 3, Cause D
Both normal but overall slowPhase 2 (check read phase)
Error: RPC FailedPhase 3, Cause F

Step 1.3 — Scan thread pool health

bash
# Quick health check on all pools
curl -s "http://<be_ip>:8060/vars" \
  | grep -E "(async_delta_writer|memtable_flush|segment_replicate_sync)\.(pending|execute|io)"

If any pending metric is non-zero and sustained → pool is saturated → proceed to Phase 2.


Phase 2 — Identify Slow Phase (Read vs Write vs Publish)

Step 2.1 — Enable and read load profile

sql
-- Session variable (Broker Load / INSERT INTO)
SET enable_profile = true;
-- Auto-enable for long imports (>60s)
SET big_query_profile_threshold = 60s;

-- Table property (Stream Load / Routine Load)
ALTER TABLE <table_name> SET ("enable_load_profile" = "true");

-- View profiles
SHOW PROFILELIST;
ANALYZE PROFILE FROM '<profile_id>';

Step 2.2 — Profile interpretation

Profile signalBottleneck
OLAP_TABLE_SINK time highWrite phase slow
CONNECTOR_SCAN / FileScanNode time highRead phase slow
OlapTableSink.RpcClientSideTime >> RpcServerSideTimeNetwork / RPC framework
OlapTableSink.RpcServerSideTime highServer-side storage write slow
LoadChannel.WaitFlushTime highmemtable flush pool bottleneck
LoadChannel.WaitWriterTime highasync_delta_writer pool bottleneck
LoadChannel.WaitReplicaTime highReplica sync slow
PushChunkNum Max/Min variance largeData skew → uneven write load

Step 2.3 — Route to cause

Bottleneck foundGo to
Write slow: pool pending/execute highPhase 3, Cause A
Write slow: BRPC saturatedPhase 3, Cause B
Write slow: pk_preload highPhase 3, Cause C
Publish slow: publish queue growingPhase 3, Cause D
Read slow: source sidePhase 3, Cause E
RPC Failed errorPhase 3, Cause F

Phase 3 — Take Action by Cause

Cause A — Write Slow: Thread Pool Bottleneck

Confirm all match:

  • async_delta_writer.pending non-zero and sustained, OR memtable_flush.io ≈ execute
  • LoadChannel.WaitFlushTime or WaitWriterTime high in profile
  • Cluster CPU and network are not saturated (ruling out Cause B)

Mechanism: Import pipeline writes through async_delta_writer → memtable_flush → disk. When the writer pool or flush pool is saturated, new tablet write tasks queue. The BRPC callback on the coordinator side waits past its deadline. If the disk (HDD) is the IO bottleneck, adding threads makes it worse — reduce concurrency instead.

bash
# Check pool saturation
curl -s "http://<be_ip>:8060/vars" | grep "async_delta_writer"
# async_delta_writer_pending: NNN  ← non-zero = pool too small
# async_delta_writer_execute: NNN  ← high with low pending = within-task bottleneck

curl -s "http://<be_ip>:8060/vars" | grep "memtable_flush"
# memtable_flush_io: NNN  ← if ≈ execute, disk is the bottleneck
sql
-- v3.2+: increase writer threads (all BEs at once)
UPDATE information_schema.be_configs SET value = 32
WHERE name = 'number_tablet_writer_threads';  -- default 16

-- Increase flush threads per disk (if IO util < 70%)
UPDATE information_schema.be_configs SET value = 4
WHERE name = 'flush_thread_num_per_store';  -- default 2 per disk

-- If HDD and IO > 90%: REDUCE threads to improve per-task throughput
UPDATE information_schema.be_configs SET value = 8
WHERE name = 'number_tablet_writer_threads';
bash
# v2.5+ per-BE
curl -XPOST "http://<be_ip>:8040/api/update_config?number_tablet_writer_threads=32"
curl -XPOST "http://<be_ip>:8040/api/update_config?flush_thread_num_per_store=4"

Also check RocksDB (shared-nothing) if txn_commit sub-metric is high:

bash
# Check rocksdb write latency
grep "Stalling writes" be/meta/LOG | tail -10
# If stalling: increase rocksdb write buffer

→ Go to Phase 4 to verify recovery


Cause B — Write Slow: BRPC / Network Issue

Confirm all match:

  • BRPC used ≈ total threads
  • Brpc Processing Requests counter is near 0 during timeout window (server not processing)
  • netstat -na | grep 8060 shows many connections in CLOSE_WAIT or TIME_WAIT

Mechanism: BRPC connections between coordinator BE and executor BEs become congested or enter a broken state. New RPC calls queue behind stuck connections. The coordinator sees timeout without the executor ever processing the request. This is different from Cause A where the executor receives the call but processes it slowly.

bash
# Check BRPC thread saturation
curl -s "http://<be_ip>:8060/vars" | grep -E "bthread_count|brpc_worker"

# Check interface-level latency
curl -s "http://<be_ip>:8060/vars" | grep -E "tablet_writer_(open|add_chunks|add_segment)"
# latency-99 high → server-side slow; latency-avg normal but P99 high → spiky

# Check TCP connection health
netstat -na | grep 8060 | awk '{print $6}' | sort | uniq -c
# Many CLOSE_WAIT or TIME_WAIT → stale connections
sql
-- Increase RPC timeout
ADMIN SET FRONTEND CONFIG("brpc_send_plan_fragment_timeout_ms" = "180000");
bash
# tcpdump for network-layer analysis (capture on coordinator BE)
tcpdump -i any -n port 8060 -w /tmp/brpc_$(date +%s).pcap

If BRPC is stuck (not recovering): restart the affected BE. Review brpc_connection_pool_size in FE config.

→ Go to Phase 4 to verify recovery


Cause C — Write Slow: PK Index Rebuild

Confirm all match:

  • async_delta_writer.pk_preload is high (minutes range)
  • Table is a Primary Key model table
  • Cluster has active clone or node decommission tasks in progress

Mechanism: During import, the PK model's async_delta_writer must preload (rebuild) the PK index for each tablet before writing. If the tablet is being cloned or decommissioned, the index is not in the local cache and must be rebuilt from scratch — this can take minutes per tablet and blocks the entire write pipeline for that tablet.

bash
# Confirm pk_preload is the bottleneck
curl -s "http://<be_ip>:8060/vars" | grep "pk_preload"

# Check if clone tasks are running
grep "clone tablet" be.INFO | tail -20
grep "migration" fe.log | tail -20
sql
-- Skip PK index preload during import (safe: index is rebuilt on next compaction)
UPDATE information_schema.be_configs SET value = "true"
WHERE name = 'skip_pk_preload';

-- Or per-BE
-- curl -XPOST "http://<be_ip>:8040/api/update_config?skip_pk_preload=true"

-- Enable persistent index to keep PK index on disk (avoids rebuild)
ALTER TABLE <pk_table_name> SET ("enable_persistent_index" = "true");

→ Go to Phase 4 to verify recovery


Cause D — Publish Timeout: Compaction Lag

Confirm all match:

  • FE finishTransaction log shows publish total cost >> write cost
  • starrocks_be_publish_version_queue_count (shared-nothing) or lake_publish_tablet_version_queuing_count (shared-data) elevated
  • Table is a Primary Key model table with high upsert rate

Mechanism: PK table publish uses a synchronous apply path (enable_sync_publish): the transaction cannot commit until all replicas have applied the new rowset — including replaying delete vectors against all accumulated rowsets. When compaction lags behind upserts, accumulated rowsets multiply apply time. Each publish blocks waiting for apply to complete. Subsequent imports queue behind pending publishes.

bash
# Monitor publish queue depth
curl -s "http://<be_ip>:8040/metrics" | grep "publish_version_queue_count"

# Check apply latency in BE log
grep "apply_rowset_commit finish" be.INFO | tail -20
# Format: apply_rowset_commit finish. tablet=<id> cost=<ms>ms
# Cost > 5000ms per commit → severe backlog
sql
-- Increase publish worker threads
-- (be.conf: transaction_publish_version_worker_count, default = #CPU cores)
UPDATE information_schema.be_configs SET value = 16
WHERE name = 'transaction_publish_version_worker_count';

-- Check PK compaction score (see compaction skill for full diagnosis)
-- High update compaction score → run manual compaction
-- curl -XPOST "http://<be_ip>:8040/api/compact?compaction_type=update&tablet_id=<tablet_id>"

Also check for clone tasks interfering with publish:

bash
grep "clone.*tablet" be.INFO | tail -20

→ Go to Phase 4 to verify recovery


Cause E — Read Slow: Source Side Bottleneck

Confirm all match:

  • Profile shows CONNECTOR_SCAN / FileScanNode time >> OLAP_TABLE_SINK time
  • OR Routine Load task count equals Kafka partition count and lag grows monotonically

Mechanism: The read phase (source → StarRocks) is the bottleneck. For Routine Load, parallelism is capped by Kafka partition count — adding StarRocks resources provides no relief. For Broker Load, many small files cause excessive open/seek overhead. For Stream Load with large JSON batches, deserialization is the CPU bottleneck.

Import TypeCommon CausesSolutions
Stream LoadHTTP client to StarRocks network slow; JSON format with large batchesReduce batch size; try CSV format
Routine LoadSmall batch size; too few Kafka partitionsIncrease max_routine_load_batch_size and routine_load_task_consume_second; add Kafka partitions
Broker LoadMany small files; slow file storageConsolidate files; check storage performance
INSERT INTOComplex SELECT queryOptimize query
sql
-- Routine Load: increase batch size and consumption window
ALTER ROUTINE LOAD FOR <job_name>
PROPERTIES (
  "max_routine_load_batch_size" = "209715200",   -- 200MB (default 100MB)
  "routine_load_task_consume_second" = "30"       -- default 15s
);

-- Check Routine Load parallelism vs Kafka partition count
SHOW ROUTINE LOAD FOR <job_name>\G
-- TaskRunning == Kafka partition count → cannot increase parallelism without repartitioning

For Flink connector: check Flink CPU utilization first — it is often the bottleneck, not StarRocks.

  • sink.buffer-flush.max-bytes
  • sink.buffer-flush.max-rows
  • sink.buffer-flush.interval-ms
  • checkpoint-interval

→ Go to Phase 4 to verify recovery


Cause F — RPC Failed: Statistics Collection Conflict

Confirm all match:

  • Import ERROR_MSG contains RPC Failed
  • Failure pattern is intermittent, correlated with scheduled statistics collection windows
  • FE log shows many concurrent ANALYZE tasks in information_schema.task_runs

Mechanism: Automatic ANALYZE triggers large-scale statistics scans across many tables. These scans saturate the BRPC send queue on BEs. Incoming plan fragment delivery for import tasks fails because the BRPC worker queue is full. FE retries exhaust or time out and the import transaction aborts.

bash
# Check brpc latency during the failure window
curl -s "http://<be_ip>:8060/vars" | grep exec_

# Check TCP connection state on BRPC port
netstat -na | grep 8060 | head -30
sql
-- Immediate mitigation: disable automatic statistics collection
ADMIN SET FRONTEND CONFIG("enable_collect_full_statistic" = "false");
ADMIN SET FRONTEND CONFIG("enable_statistic_collect" = "false");
ADMIN SET FRONTEND CONFIG("enable_statistic_collect_on_first_load" = "false");

-- Increase RPC timeout to tolerate BRPC congestion
ADMIN SET FRONTEND CONFIG("brpc_send_plan_fragment_timeout_ms" = "180000");

-- Long-term: tune statistics collection schedule
-- Increase interval and reduce concurrency
ADMIN SET FRONTEND CONFIG("statistic_collect_interval_sec" = "1200");
ADMIN SET FRONTEND CONFIG("statistic_collect_concurrency" = "1");

→ Go to Phase 4 to verify recovery


Phase 4 — Verify Recovery

sql
-- Confirm import tasks are completing successfully
SELECT STATE, COUNT(*) AS cnt, AVG(TIMESTAMPDIFF(SECOND, LOAD_START_TIME, LOAD_FINISH_TIME)) AS avg_sec
FROM information_schema.loads
WHERE LOAD_FINISH_TIME > DATE_SUB(NOW(), INTERVAL 10 MINUTE)
GROUP BY STATE;
-- FINISHED should dominate; CANCELLED/FAILED should be 0

-- Confirm no new import failures
SELECT LABEL, STATE, ERROR_MSG
FROM information_schema.loads
WHERE STATE = 'CANCELLED'
ORDER BY LOAD_FINISH_TIME DESC
LIMIT 10;

-- Confirm publish queue is draining (PK tables)
-- Monitor over 2-3 minutes: count should decrease
SELECT COUNT(*) AS pending_publish
FROM information_schema.loads
WHERE STATE = 'COMMITED';
bash
# Confirm thread pool metrics are back to normal
curl -s "http://<be_ip>:8060/vars" | grep "async_delta_writer_pending"
# Should be 0 or near-0

curl -s "http://<be_ip>:8060/vars" | grep "memtable_flush_io"
# Should be proportional to actual import load (not 100%)

# Confirm no new timeout errors in BE log
grep "Reached timeout\|RPC Failed" be.WARNING | tail -10
# Should be empty or timestamps should be in the past

Grafana: starrocks_be_publish_version_queue_count should return to near-0. Import throughput (sink_rows per minute) should return to baseline.


Thread Pool Configuration Reference

Shared-Nothing Write Pipeline

ParameterDefaultDescriptionDynamic
number_tablet_writer_threads16async_delta_writer pool sizeYes (v2.5+)
flush_thread_num_per_store2 per diskmemtable_flush / segment_replicate_sync / segment_flush pool sizeYes (v2.5+)
brpc_num_threads#CPU coresBRPC worker thread countNo (restart)
write_buffer_size100MBMemtable size before flush triggerYes (v2.5+)
transaction_publish_version_worker_count#CPU coresPublish version worker threadsNo (restart)
load_process_max_memory_limit_bytes100GUpper bound for import memoryNo (restart)
load_process_max_memory_limit_percent30%Actual limit = mem_limit * 90% * 30%No (restart)
skip_pk_preloadfalseSkip PK index rebuild during importYes (v2.5+)
async_load_task_pool_size10Broker Load loading thread poolNo (restart)

Shared-Data Write Pipeline

ParameterDefaultDescriptionDynamic
lake_flush_thread_num_per_store2 × #CPUmemtable flush pool for shared-dataYes (v2.5+)

Applying Dynamic Parameters

sql
-- v3.2+: apply to all BEs at once
UPDATE information_schema.be_configs SET value = <value> WHERE name = '<param>';
SELECT * FROM information_schema.be_configs WHERE name = '<param>';  -- verify
bash
# v2.5+: apply per BE
curl -XPOST "http://<be_ip>:<be_http_port>/api/update_config?<param>=<value>"
curl "http://<be_ip>:<be_http_port>/varz" | grep <param>  # verify

Static parameters must be set in be.conf and require restart.


Import Observation Reference

Show Commands

CommandPurpose
SHOW ROUTINE LOADView Routine Load job status
SHOW PIPESView Pipe job status
SHOW LOADView Broker Load/Insert Into/Spark Load tasks (running + recently completed)
SHOW ROUTINE LOAD TASKView Routine Load tasks

information_schema.loads — Full Schema

FieldDescription
IDGlobal unique ID
LABELImport job label
PROFILE_IDProfile ID for ANALYZE PROFILE FROM 'profile_id' (NULL if no profile)
DB_NAME / TABLE_NAMETarget database/table
USER / WAREHOUSEInitiating user / warehouse
STATEPENDING, BEGIN, QUEUEING, BEFORE_LOAD, LOADING, PREPARING, PREPARED, COMMITED, FINISHED, CANCELLED
PROGRESSETL and LOADING phase progress
TYPEBROKER, INSERT, ROUTINE, STREAM
PRIORITYHIGHEST, HIGH, NORMAL, LOW, LOWEST
SCAN_ROWS / SCAN_BYTESTotal scanned rows/bytes
FILTERED_ROWS / UNSELECTED_ROWSQuality-filtered / WHERE-filtered rows
SINK_ROWSSuccessfully imported rows
CREATE_TIME / LOAD_START_TIME / LOAD_COMMIT_TIME / LOAD_FINISH_TIMETimestamps
ERROR_MSGError message (NULL if none)
TRACKING_SQLQuery for rejected records
REJECTED_RECORD_PATHPath to quality-rejected records

Common Issues Quick Reference

IssueCauseFix
Broker Load tasks queue foreverasync_load_task_pool_size too small or stuck tasksIncrease pool size; trace stuck task by label
Reached timeout on Stream Loadbrpc / async_delta_writer pool stuckRestart BE; tune brpc threads
publish timeout on PK tableCompaction lagging or PK index rebuildTune compaction; skip_pk_preload = true
RPC Failed during nightly batchStatistics collection saturating brpcDisable full statistics; reduce concurrency
Routine Load not keeping upSmall batch, few Kafka partitionsIncrease batch size; add Kafka partitions

Related Cases

  • case-001-broker-load-backlog — task pool saturation root cause
  • case-002-rpc-failed-statistics — statistics collection starving RPC
  • case-007-memory-tracking-leak — slow imports caused by memory tracker leak
  • case-009-stream-load-stuck — tablet meta cache bug

Causal Chains

Chain 1: async_delta_writer Pool Saturation → Write Timeout

High-concurrency imports saturate async_delta_writer thread pool
  ↓ observable: BE pool metrics show active ≈ total with queue > 0 for async_delta_writer
New delta write tasks queue; flush cannot proceed
  ↓ observable: BE log shows wait_flush duration growing per tablet write
BRPC callback exceeds deadline waiting for write acknowledgement
  ↓ observable: BE log "Reached timeout" on tablet write RPC; import task STATE stuck in LOADING
FE times out waiting for tablet commit

Import job fails with Reached timeout; data not committed.

Trigger conditions: write_buffer_size too small causing excessive flush frequency; import concurrency exceeds thread pool capacity.

Break point: Increase number_tablet_writer_threads; raise write_buffer_size; reduce import concurrency at source.


Chain 2: Statistics Collection Saturates BRPC → RPC Failed

Automatic ANALYZE triggers large-scale statistics scan across many tables
  ↓ observable: FE log shows many concurrent ANALYZE tasks in information_schema.task_runs
BRPC send queue on BE fills; plan fragment delivery fails
  ↓ observable: BE log "plan fragment send fail"; FE log "RPC Failed" sending fragments to BE
Import fragment cannot reach BE; FE retries exhaust or time out
  ↓ observable: information_schema.loads shows STATE = FAILED with error containing "RPC Failed"
Import transactions abort

Import jobs fail intermittently during scheduled statistics collection windows.

Trigger conditions: Statistics collection scheduled during peak import hours; brpc_worker_threads under-provisioned.

Break point: Separate statistics schedule from peak import windows; reduce statistic_collect_concurrency; disable via ADMIN SET FRONTEND CONFIG("enable_collect_full_statistic" = "false").


Chain 3: PK Table Compaction Lag → Rowset Accumulation → Publish Timeout

High-frequency upserts on PK table; compaction cannot keep pace
  ↓ observable: starrocks_be_publish_version_queue_count elevated and growing; num_rowset per tablet rising
Apply thread must replay many delete vectors against accumulated rowsets
  ↓ observable: BE log shows pk_preload latency increasing; wait_replica extends per commit
Publish version step blocks waiting for apply to complete
  ↓ observable: FE finishTransaction log shows publish cost >> write cost
Transaction publish deadline exceeded

Import fails with publish timeout; subsequent imports on the same table also stall.

Trigger conditions: PK table with high upsert rate; pk_index_cache_capacity too small; max_pk_compaction_threads not scaled.

Break point: Increase max_pk_compaction_threads; enlarge pk_index_cache_capacity; monitor starrocks_be_publish_version_queue_count as leading indicator.


Chain 4: Memory Tracker Leak → Import Throttle → Progress Frozen

Long-running BE process accumulates unreleased memory in tracker
  ↓ observable: SHOW PROC '/current_queries' shows cumulative memUsageBytes not decreasing after query completion
Memory tracker reports usage near mem_limit; import admission control activates
  ↓ observable: BE log shows import tasks throttled or rejected with "memory exceed"
Import tasks queue but cannot start; progress metric frozen
  ↓ observable: information_schema.loads shows STATE = LOADING with PROGRESS barely advancing over minutes
Import times out or is manually cancelled

Import appears to start successfully but makes no progress; restarting BE temporarily resolves until leak accumulates again.

Trigger conditions: Memory tracker reference-count bug in a specific code path; BE running for days without restart.

Break point: Audit SHOW PROC '/current_queries' memory; rolling restart affected BE; patch tracker release on error exit paths.


Chain 5: Routine Load Kafka Partition Bottleneck → Lag Grows

Routine Load task count capped by Kafka partition count
  ↓ observable: SHOW ROUTINE LOAD shows TaskRunning == Kafka partition count; cannot increase parallelism
Incoming message rate exceeds drain rate; lag grows
  ↓ observable: Kafka consumer group lag metric grows monotonically; PROGRESS in information_schema.loads stalls
Unconsumed messages accumulate in Kafka topic
  ↓ observable: kafka-consumer-groups.sh --describe shows LAG increasing per partition
Routine Load lag grows unboundedly; data freshness SLA breached

Downstream queries see stale data; eventually Kafka retention boundary reached and messages dropped.

Trigger conditions: Topic created with too few partitions; data volume grew after initial sizing.

Break point: Increase Kafka topic partition count; raise desired_concurrent_number in Routine Load job after repartitioning.


Cross-Skill Guides


Resources

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Import làm được gì?

Use when import jobs are slow, timing out, or failing — Stream Load, Broker Load, Routine Load, INSERT INTO, Flink connector. Covers write-slow triage (async_delta_writer / memtable_flush / segment_replicate_sync thread pools), publish timeout on PK tables, RPC Failed errors, Reached timeout auto-diagnostics (v3.4+), and load profile analysis. Also covers read-slow causes and Kafka partition bottlenecks.

Vì sao nên dùng Import trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Import là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Import trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/StarRocks/starrocks-debug-skills/tree/main/import. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Import?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Import với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Import với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Import có miễn phí không?

Có. Kỹ năng này được StarRocks phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇