DanielLeens opened a new issue, #13556:
URL: https://github.com/apache/seatunnel/issues/13556

   ## Improvement
   
   The Elasticsearch sink option reference currently describes `max_batch_size` 
only as “batch bulk doc max size”. Its default is 10 documents per writer. For 
large batch imports, leaving that value implicit can produce many small 
synchronous Bulk API requests; users need an explicit example and a method for 
choosing a batch size.
   
   The default traces back to #2330 (`2a1fd5027f0`). 
`ElasticsearchSinkWriter.write()` flushes when the buffered document count 
reaches the threshold, and completion flushes the remainder. This is a 
documentation/configuration-usability improvement, not a claim that the default 
is invalid for every workload.
   
   ## Proposed scope and acceptance criteria
   
   - Clarify the per-writer document-count unit and existing default 10 in both 
English and Chinese sink docs.
   - Add an explicit batch-import configuration example with 
`max_batch_size=1000`, identified as a measured starting point rather than a 
universal optimum.
   - Explain document size, payload bytes, buffered memory, concurrent table 
writers, and low-volume latency; link the existing Zeta timer-flush section.
   - Preserve the runtime/default, APIs, delivery semantics, and existing 
timer-flush example using 10000. No new dependencies.
   - Validate Markdown/internal links and the configuration against the pinned 
source/runtime, including a partial final batch.
   
   Duplicate searches covered open and closed Elasticsearch bulk/batch PRs and 
the selected author's PRs. #3148 and #3738 address retry/locking, and the 
current Elasticsearch sink patch in #11787 changes general documentation/auth 
text; none supplies this focused sizing guidance.
   
   ### Reproduced workload and results
   
   Pinned SeaTunnel dev `ee0fb0d72f67edbcd6caf08360fd354fa68e002f` and DataX 
master `5993b26cda90f3e6a4a2fd2e42843efeb770ab3d`, both complete engines, Java 
11, one writer, 1 GiB maximum heap, the same frozen MySQL source, and an 
existing self-hosted Elasticsearch 8.9.0 target. The engine host has 4 vCPUs 
and 16 GiB RAM and retains its existing background services. Each job writes 
1,000,000 rows with 19 fields. Both tools receive a 100,000-row warmup and 
three alternating measured pairs. Every measured result is reconciled by 
business ID and all 19 values, including explicit NULL versus empty values. 
JVMs are restarted per job; the warmup does not imply same-JVM JIT warmup.
   
   Decimal, date, time, timestamp, and binary use explicitly declared text 
encodings (binary is Base64); other numeric fields are native. Each job uses a 
fresh one-shard, zero-replica fixture index, `refresh_interval=-1`, and 
non-indexed keyword strings. HTTP compression is disabled for both tools. Both 
also use the same private-TCP preconnect guard and a 100ms owned-process socket 
sampler. These index settings isolate a rebuildable ingestion fixture and are 
not production replica recommendations. The target is shared, not exclusive. 
Timing includes engine startup, successful Bulk acknowledgements, and process 
exit; explicit refresh/search and reconciliation occur outside timing. These 
are end-to-end writer pipelines, not a sink-only microbenchmark or a 
full-text/vector/update/delete result.
   
   **Batch option omitted:** DataX uses its source default `batchSize=1024`; 
SeaTunnel uses its source default `max_batch_size=10`. All other compared 
fixture settings remain fixed.
   
   | Pair | DataX seconds | SeaTunnel seconds | DataX / SeaTunnel throughput |
   | --- | --- | --- | --- |
   | 1 | 81.899 | 533.875 | 6.519 |
   | 2 | 82.033 | 513.338 | 6.258 |
   | 3 | 81.974 | 505.450 | 6.166 |
   
   **Explicit equal batch size of 1000:**
   
   | Pair | DataX seconds | SeaTunnel seconds | DataX / SeaTunnel throughput |
   | --- | --- | --- | --- |
   | 1 | 81.926 | 76.905 | 0.939 |
   | 2 | 72.062 | 80.000 | 1.110 |
   | 3 | 71.997 | 78.015 | 1.084 |
   
   The ratio is SeaTunnel elapsed time divided by DataX elapsed time for equal 
row counts. The default-batch profile reproduces a configuration-driven gap in 
all three pairs. The equal-batch profile does not reproduce a >=20% gap. 
Profiles ran in separate phases, so this is not a claim of an exact 
simultaneous before/after speedup. The results motivate sizing guidance; they 
do not establish 1000 as universally optimal or justify changing a historical 
default.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to