Load Best Practices and Performance Tuning
Choose a load method, batch size, and concurrency that meet your freshness requirements without creating excessive small transactions. In VeloDB Cloud, compute clusters write to shared object storage. Host configuration and storage durability are managed by the service.
Quick navigation
| Concern | Recommended Practice | Section |
|---|---|---|
| Choose a load method | Select by data source and real-time requirements | Choose an Appropriate Load Method |
| Table model | Prefer the Duplicate Key model | Table Model and Indexes |
| Partitioning and bucketing | Use 1-10 GB per tablet as a starting estimate | Partitioning and Bucketing Configuration |
| Random bucketing | Evaluate load_to_single_tablet for random bucketing | Random Bucketing Load Optimization |
| High-frequency small loads | Client-side batching plus Group Commit | Batching Strategy |
| Number of partitions per load | Restrict to a small number to avoid too many Memtables | Partition Load and Memory Control |
| Large data load | Choose batches within method limits and your retry budget | Large-Scale Data Batched Load |
| Broker Load concurrency | Split compressed or columnar files for concurrency | Broker Load Concurrency |
| Stream Load concurrency | Tune client concurrency gradually | Stream Load Concurrency |
Choose an appropriate load method
VeloDB Cloud provides several load methods that share the same core workflow but are optimized for different scenarios. Choose one based on your data source and business requirements:
| Load Method | Protocol | Execution Mode | Typical Data Sources | Applicable Scenarios |
|---|---|---|---|---|
| Stream Load | HTTP | Synchronous | Local files, data streams | Real-time writes (such as data pushed by applications) |
| Broker Load | SQL | Asynchronous | HDFS, S3, and other external storage | Large-scale batch load |
| Routine Load | SQL | Asynchronous streaming | Kafka | Real-time synchronization of message queue data, with Exactly-Once support |
| Insert Into / Select | SQL | Synchronous by default | VeloDB Cloud tables, Hive, MySQL, S3 TVF | ETL jobs, external data integration |
| MySQL Load | MySQL LOAD DATA | Synchronous | Local CSV files | Small-scale tests or migration for MySQL users (FE forwards as Stream Load) |
Load best practices
The following sections address several common concerns in data load and provide best practices that you can apply directly.
Table model and indexes
Table model selection
Use the Duplicate Key model when you need to retain raw rows without deduplication or aggregation:
- It only stores raw data, with no aggregation or deduplication, giving the shortest load path.
- It avoids write-time aggregation and deduplication. Query performance still depends on the workload, indexes, and data distribution.
- The Aggregate model needs to aggregate by Key columns and the Unique Key model needs to deduplicate. Both add extra computation (sorting, deduplication) on the BE side during the MemTable stage and increase CPU and memory consumption.
Choose the Aggregate or Unique Key model only when you actually need aggregation or deduplication by Key. For more information, see Data Model.
Index control
Indexes (such as bitmap indexes and inverted indexes) need to be updated synchronously during load and increase write maintenance cost. Recommendations:
- Create indexes only for frequently queried fields.
- Avoid redundant indexes to reduce index building and validation on BE during writes, lowering CPU and memory usage and improving load throughput.
Partitioning and bucketing configuration
Partitioning and bucketing determine how data is distributed across BE nodes and the degree of parallelism, directly affecting load and query performance.
Single tablet size: 1-10 gb
Use 1 to 10 GB of compressed data per tablet as an initial sizing estimate, then adjust for the workload and cluster size:
| Tablet Size | Impact |
|---|---|
| Too small | Poor aggregation effect, increased pressure on metadata management |
| Too large | Higher per-tablet processing and recovery cost |
| 1-10 GB (recommended) | Starting point for balancing write parallelism and metadata overhead |
Estimate the bucket count per partition with bucket count = estimated compressed data size per partition / target tablet size. Combine this with an appropriate bucket key (a column with a suitable value distribution) to avoid data skew, balance the load across BE nodes, and improve parallel write efficiency.
For details, see Data Distribution.
Partition design: reduce distribution and memory pressure
Partition by the business query pattern (such as time or region) so that during load, data is distributed only to the target partitions, avoiding processing metadata and files of unrelated partitions. In addition:
- Writing to multiple partitions at the same time activates a large number of Tablets. Each active tablet writer can occupy its own MemTable, significantly increasing memory pressure on BE.
- When memory is tight, an early Flush is triggered, generating many small Segment files and causing frequent Compaction and write amplification.
By limiting the number of active partitions (such as loading day by day), you can reduce the number of simultaneously active Tablets, ease memory pressure, generate larger Segment files, and reduce the Compaction load, thereby improving parallel write efficiency and subsequent query performance.
Random bucketing load optimization
When using Random bucketing, you can enable single-tablet load mode by setting load_to_single_tablet=true:
- Data is written directly to a single tablet, reducing the number of tablet writers for that load. The cluster can still use network communication to coordinate and write the data.
- Concentrating writes on a single tablet reduces the generation of small Segment files and avoids the write amplification caused by frequent Compaction.
- It can reduce small-file overhead, but concentrating a load on one tablet can limit its parallelism. Measure the effect on your workload.
For details, see Random Bucketing.
Batching strategy
Loads create transactions and flush in-memory data into Segment files. Cloud transaction state is managed through the metadata service. High-frequency small-batch loads (KB-level) cause:
- Frequent transaction and metadata operations.
- Frequent BE MemTable flushes, generating many small Segment files.
- Frequent Compaction, leading to severe write amplification.
You can mitigate this by combining client-side and server-side batching:
| Batching Method | Applicable Scenarios | Recommended Practice |
|---|---|---|
| Client-side batching | Batch writes that the client controls | Accumulate data on the client to hundreds of MB to several GB before initiating a load. Replacing many small transactions with a single large one reduces the frequency of transaction operations and MemTable flushes, avoiding storage fragmentation and the resource consumption of subsequent Compaction. |
| Server-side batching (Group Commit) | High-concurrency, small-data-volume loads | Enable Group Commit so that the server merges multiple small batches within a short window into a single transaction. The merged large transaction generates larger Segment files and reduces background Compaction pressure. This is especially suitable for high-frequency small-batch scenarios such as logs and IoT data. |
Partition load and memory control
During load, workers first write data to in-memory MemTables. Buffer sizing is service-managed and can vary by table model and adaptive settings. When the MemTable fills up, it is asynchronously flushed to disk to generate Segment files. Each active tablet writer can have its own MemTable in memory, so the number of partitions covered by a single load directly affects memory usage:
- Too many partitions leads to many active Tablets, which leads to many active MemTables, which increases memory usage.
- When memory usage is too high, an early flush is triggered to avoid process OOM.
- Early flushes generate many small files, which further degrades load performance.
To achieve stable load throughput:
- Load partitions in order: for example, load day by day so that data writes concentrate on a single partition, reducing MemTable scattering and the number of flushes, and lowering memory fragmentation and I/O pressure.
- Strictly control the number of partitions covered by a single load to avoid early flushes triggered by too many MemTables.
Large-scale data batched load
When there are many files and the data volume is very large, load in batches to reduce the cost of retries and avoid concentrated impact on BE memory and disk:
| Data Source | Recommended Load Method | Recommended Batch Size |
|---|---|---|
| Remote files such as HDFS or object storage | Broker Load | Each batch up to 100 GB as an initial planning guideline, subject to method-specific limits and retry cost |
| Large local files | Doris Streamloader (auto-batching) | Controlled automatically by the tool |
Broker Load concurrency
Concurrency strategies vary by file type:
- Compressed text files: use multiple files when the compression format prevents splitting within a file.
- Parquet and ORC files: row groups and stripes can provide scan parallelism. Avoid assuming that every columnar file is unsplittable. Core 26.1.3 release notes include improved refinement of eligible source splits on execution nodes.
- Uncompressed CSV and JSON files: eligible files can be split and read concurrently, subject to format and scanner constraints.
For method-specific concurrency and scanner limits, see Broker Load.
Stream Load concurrency
Increase client concurrency gradually while measuring throughput, visibility delay, errors, and cluster utilization. Stop increasing it when throughput plateaus or errors and latency rise. The upstream values of 128 HTTP workers and 512 scanner threads do not establish a Cloud concurrency limit. Service thread-pool settings are managed by VeloDB Cloud support.
Concurrency trade-offs for low-latency scenarios
For low-latency scenarios such as real-time monitoring:
- Reduce concurrency appropriately to avoid resource contention.
- Combine with the asynchronous mode (
async_mode) of Group Commit to merge small transactions and reduce transaction commit latency.
VeloDB Cloud load internals
Understanding the following internals helps you make better tuning decisions in complex scenarios.
Design philosophy
VeloDB Cloud separates compute from persistent storage. Data loading involves the following components:
- Frontend (FE): validates requests and permissions, manages database and table definitions, plans loads, schedules jobs, and coordinates transaction operations.
- Backend (BE): executes load tasks, processes incoming data, generates Segment files, and writes them to shared object storage. BE nodes also use local storage for caches and transient data, such as Group Commit WALs.
- Metadata service (Meta Service): manages tablet and Rowset metadata and persists transaction state for the shared-storage architecture.
- Shared object storage: stores durable table data independently of the compute clusters.
The data load design aims to meet diverse business needs such as real-time writes, streaming synchronization, batch loading, and external data source integration. Its core principles include:
| Design Goal | Implementation |
|---|---|
| Consistency and atomicity | Each transaction commits its accepted rows atomically. Filters can exclude rows. Supported label-based retries avoid duplicate submissions within the label retention window. Group Commit has different acknowledgment and retry semantics. |
| Flexibility | Supports a variety of data sources (local files, HDFS, S3, Kafka, and so on) and formats (CSV, JSON, Parquet, ORC, and so on) to fit different scenarios. |
| Efficiency | Leverages the distributed architecture to process data in parallel, with multiple BE nodes processing data concurrently to improve throughput. |
| Simplicity | Provides lightweight ETL functionality so that you can clean and transform data during load, reducing dependence on external tools. |
| Flexible modeling | Supports the Duplicate Key, Unique Key, and Aggregate Key models, allowing data aggregation or deduplication during load. |
Common load workflow
Regardless of the load method (Stream Load, Broker Load, Routine Load, and so on), the core workflow is essentially the same:
-
Submit the load task
- You submit a load request through a client (such as HTTP, JDBC, or a MySQL client), specifying the data source (such as a local file, Kafka topic, or HDFS file path), target table, file format, and load parameters (such as delimiter and error tolerance).
- For load methods that support client-supplied labels, use a unique Label for each logical batch and reuse it only when checking or retrying that batch. Group Commit generates a shared label and does not provide per-request label deduplication. For example, in Stream Load you specify the Label through an HTTP header.
- The VeloDB Cloud Frontend (FE) receives the request, validates permissions, checks whether the target table exists, and parses the load parameters.
-
Task assignment and coordination
- FE analyzes data distribution (based on the table's partitioning and bucketing rules), generates a load plan, and selects a Backend (BE) node as the Coordinator to coordinate the entire task.
- Use the generated warehouse endpoint for Stream Load. The service selects the coordinator and supplies the table metadata.
- The load plan distributes data to multiple BE nodes to ensure parallel processing for higher efficiency.
-
Data reading and distribution
- The Coordinator BE reads data from the data source (for example, pulling messages from Kafka, reading files from S3, or directly receiving an HTTP data stream).
- VeloDB Cloud parses the data format (such as splitting CSV or parsing JSON) and supports user-defined lightweight ETL operations, including:
- Pre-filtering: filter raw data to reduce processing overhead.
- Column mapping: adjust the correspondence between source columns and target table columns.
- Data transformation: process data using expressions.
- Post-filtering: filter the transformed data.
- After parsing, the Coordinator BE distributes data to multiple downstream Executor BEs according to the partitioning and bucketing rules.
-
Data write
- Data is distributed to multiple BE nodes and written into in-memory tables (MemTables), sorted by Key columns. For the Aggregate or Unique Key model, VeloDB Cloud aggregates or deduplicates by Key (using
SUM,REPLACE, and so on). - When a MemTable is flushed or the task ends, workers generate columnar Segment files that make up a Rowset. Cloud workers persist these files in shared object storage.
- Each BE processes its assigned data independently and reports its status to the Coordinator after the write completes.
- Data is distributed to multiple BE nodes and written into in-memory tables (MemTables), sorted by Key columns. For the Aggregate or Unique Key model, VeloDB Cloud aggregates or deduplicates by Key (using
-
Transaction commit and publish
- The load execution path requests transaction commit through the Cloud transaction manager and metadata service. A committed, visible transaction makes its accepted rows queryable. This path does not use a customer-configurable majority of local BE replicas.
- A failed transaction is aborted. If the client loses the response, first check transaction or job status because the transaction might already have committed.
-
Result return
- Ordinary synchronous Stream Load and
INSERToperations return the load result directly, including success/failure status and error details (such asErrorURL). - Asynchronous methods (such as Broker Load) return a task ID and Label. You can use
SHOW LOADto view progress, error row count, and detailed information. - Operations are recorded in audit logs to support later traceability.
- Ordinary synchronous Stream Load and
MemTable forwarding
The upstream Apache Doris document describes MemTable forwarding for INSERT INTO...SELECT in integrated storage and compute deployments. This optimization and its replica-based results do not apply to VeloDB Cloud:
- Bottleneck of the traditional flow: the Sink node has to encode data into Block format and transfer it to downstream nodes via Ping-pong RPC, which involves multiple rounds of encoding and decoding and increases overhead.
- Optimization: the Sink node directly handles MemTables, generates Segment data, and transfers it via Streaming RPC. This reduces encoding/decoding and transfer waiting, and provides more accurate memory backpressure.
- Performance gain: the upstream source reports that load time drops to 36% in single-replica scenarios and 54% in three-replica scenarios, with overall performance improving by more than 100%.
- Applicable scope: the described optimization requires an integrated storage and compute deployment, rather than the Cloud architecture.
Load in the compute-storage decoupled architecture
In the compute-storage decoupled architecture, load optimization focuses on decoupling data storage and transaction management:
- Data storage
- Durable table data resides in shared object storage. Workers upload generated Segment files, while local storage serves caches and other transient state such as Group Commit WALs.
- The BE local File Cache asynchronously caches hot data, improving query hit rate through TTL and Warmup strategies.
- Metadata (such as Tablet and Rowset metadata) is stored by Meta Service in FoundationDB, instead of in the local RocksDB on BE.
- Transaction processing
- FE coordinates transaction operations through Meta Service, which persists transaction state independently of the FE Edit Log path.
- Meta Service manages transactions through standard interfaces (
beginTransaction,commitTransaction) and relies on FoundationDB's global transaction capabilities to ensure consistency. - The Cloud transaction manager uses metadata-service operations to begin, commit, and abort transactions. Execution paths still involve FE planning and coordination.
Trade-offs between latency and throughput
The latency and throughput of data load often need to be balanced in real business scenarios:
- Lower latency: lets you see the latest data sooner, but smaller write batches and higher write frequency lead to more frequent background Compaction, consuming more CPU, I/O, and memory, and increasing pressure on metadata management.
- Higher throughput: by increasing the data volume per load and reducing the number of loads, you significantly lower metadata pressure and background Compaction overhead, improving overall system performance. However, the latency between writing data and its visibility increases.
Therefore, while meeting the latency requirements of your business, maximize the data volume per load as much as possible to improve throughput and reduce system overhead.
Upstream test data
The following measurements are retained from Apache Doris documentation. They describe the stated self-managed test setup, not a VeloDB Cloud warehouse. The source does not provide the complete software version and execution configuration for the Flink test. These results have not been independently reproduced on VeloDB Cloud and are not throughput or latency guarantees.
Flink end-to-end latency
The test uses the Flink Connector in batched-write mode, focusing on end-to-end latency and load throughput. The batching interval is controlled by the Flink Connector parameter sink.buffer-flush.interval. For details on using the Flink Connector, see Flink Connector.
Machine configuration:
- 1 FE: 8-core CPU, 16 GB memory
- 3 BEs: 16-core CPU, 64 GB memory
Dataset:
- TPCH lineitem data
Load performance under different batching intervals and concurrency levels:
| Batching interval (s) | Load concurrency | Bucket count | Throughput (rows/s) | End-to-end average latency (s) | End-to-end P99 latency (s) |
|---|---|---|---|---|---|
| 0.2 | 1 | 32 | 6073 | 0.211 | 0.517 |
| 1 | 1 | 32 | 31586 | 0.71 | 1.39 |
| 10 | 1 | 32 | 67437 | 5.65 | 10.90 |
| 20 | 1 | 32 | 93769 | 10.962 | 20.682 |
| 60 | 1 | 32 | 125000 | 32.46 | 62.17 |
| 0.2 | 10 | 32 | 9300 | 0.38 | 0.704 |
| 1 | 10 | 32 | 34633 | 0.75 | 1.47 |
| 10 | 10 | 32 | 82023 | 5.44 | 10.43 |
| 20 | 10 | 32 | 139731 | 11.12 | 22.68 |
| 60 | 10 | 32 | 171642 | 32.37 | 61.93 |
Effect of different bucket counts on load performance:
| Batching interval (s) | Load concurrency | Bucket count | Throughput (rows/s) | End-to-end average latency (s) | End-to-end P99 latency (s) |
|---|---|---|---|---|---|
| 1 | 10 | 4 | 34722 | 0.86 | 2.28 |
| 1 | 10 | 16 | 34526 | 0.8 | 1.52 |
| 1 | 10 | 32 | 34633 | 0.75 | 1.47 |
| 1 | 10 | 64 | 34829 | 0.81 | 1.51 |
| 1 | 10 | 128 | 34722 | 0.83 | 1.55 |
Group Commit test
For high-frequency small-batch loads, evaluate Group Commit to reduce transaction overhead. For Group Commit performance test data, see Group Commit Performance.
FAQ
Q1: How do I choose an appropriate load method?
Choose by data source and real-time requirements: use Stream Load for real-time pushes of local files; Broker Load for large batches in HDFS/S3; Routine Load for streaming data from Kafka; Insert Into / Select for ETL between external tables or VeloDB Cloud tables. Use MySQL Load for MySQL-compatible scenarios.
Q2: Why do high-frequency small-batch loads significantly affect performance?
High-frequency small loads cause VeloDB Cloud to perform Compaction frequently, leading to severe write amplification. Either accumulate data on the client to several MB to several GB, or enable Group Commit to batch on the server side.
Q3: What should I do if loads produce many small files and Compaction pressure is high?
Enable Group Commit to merge small transactions, or accumulate data on the client to hundreds of MB to several GB before loading. At the same time, review the partitioning and bucketing design to avoid having too many active Tablets.
Q4: Why should a single load not cover too many partitions?
Each active tablet writer can hold a MemTable in memory. When the total memory occupied by active Memtables is too high, an early flush is triggered to avoid OOM, generating many small files and degrading load performance. Limiting the number of partitions in a single load alleviates this issue.
Q5: Is the data volume per load always better when larger?
No. The upstream 100 GB batch recommendation is a planning guideline, not a universal request limit. Select a batch size within the load method limits and your retry budget. An overly large batch increases retry cost and the impact on BE memory and disk. For large local files, you can use the streamloader tool, which automatically batches.
Q6: Why is a Tablet size of 1-10 GB recommended?
A tablet that is too small increases metadata overhead and reduces batching efficiency. A tablet that is too large increases per-tablet processing and recovery cost. 1-10 GB is an initial sizing estimate. Adjust it for query performance, write parallelism, and metadata overhead in your warehouse.
Q7: How should I set Stream Load concurrency?
Increase client concurrency gradually and measure throughput, errors, and visibility delay. There is no verified universal 128/512 request limit for VeloDB Cloud. Contact VeloDB Cloud support for service-side capacity or thread-pool investigations.
Q8: In which scenarios does MemTable forwarding take effect?
The upstream optimization applies only to INSERT INTO...SELECT in an integrated storage and compute deployment. The upstream source reports load times of 36% and 54% of the original for one- and three-replica tests, respectively. These are upstream measurements without a complete reproduction configuration, not Cloud results. The compute-storage decoupled mode does not currently support this optimization.
Q9: How do I avoid data skew?
Start with an estimated 1-10 GB of compressed data per tablet and adjust the bucket count for your workload. Choose a bucket key with a suitable value distribution. In random bucketing scenarios, you can enable load_to_single_tablet=true to reduce distribution overhead.
Troubleshooting
| Symptom | Possible Cause | Investigation and Resolution |
|---|---|---|
| Low load throughput, frequent Compaction | High-frequency small-batch loads cause write amplification | Batch on the client side, or enable Group Commit |
| Many small files generated during load | A single load covers too many partitions, causing early Memtable flush | Reduce the number of partitions per load; load partitions in order |
| Long delay before loaded data is visible | Transaction or visibility processing is delayed | Check the result and status interface for the load method and contact VeloDB Cloud support if the delay persists |
| BE OOM or frequent Flush | Too many simultaneously active partitions/Tablets, MemTables scattered | Load partitions in order; reduce bucket count; lower concurrency |
| High transaction/metadata pressure | High-frequency small-batch loads, too many transactions | Enable Group Commit, or batch on the client side; evaluate whether concurrency is too high |
| Compaction cannot keep up, queries slow down | Too many small files, severe write amplification | Increase the data volume per load; tune bucketing; ask VeloDB Cloud support to investigate service-side compaction when necessary |
| Load jitter under compute-storage decoupling | Object storage QPS throttling | Control concurrency; increase the data volume per batch; ask VeloDB Cloud support to check service-side storage throttling |
| Load reports error rows | Data format mismatch, column mapping error | Inspect error samples through the returned ErrorURL; adjust column mapping, delimiters, or error tolerance |
| Requests stall as concurrency rises | Client or service resources are saturated | Reduce concurrency, retain request identifiers, and contact VeloDB Cloud support |
| Stream Load slows under load | Endpoint or cluster capacity is saturated | Reduce concurrency and ask VeloDB Cloud support to investigate |
| Low Broker Load concurrency | Too few eligible scan splits or too little job parallelism | Check file format, compression, row groups or stripes, and the Broker Load parallelism settings |
| High retry cost when a single Broker Load fails | Batch size is too large | Reduce batch size within the load method limits and your retry budget |
Cost considerations
Loading and compaction consume cluster compute and storage. Test on a representative sample, stop load generators after measuring, and remove test data when it is no longer needed. See Billing.