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

   ### Search before asking
   
   - [x] I searched existing issues and open/closed PRs. #10118 and #10768 are 
merged historical changes; neither is an open fix for this measured regression. 
I found no duplicate sparse-LOB batch performance issue.
   
   ### What happened
   
   With one million short Unicode values and one NULL every 17 rows, the Oracle 
JDBC sink is substantially slower than the equivalent DataX JDBC component 
path. Three alternating, warmed trials all reproduced the difference and every 
destination value was reconciled exactly, including NULLs.
   
   | Native Oracle target type | DataX rows/s, rounds 1 / 2 / 3 | SeaTunnel 
rows/s, rounds 1 / 2 / 3 | Median DataX / SeaTunnel |
   | --- | --- | --- | --- |
   | CLOB | 24712.211 / 24955.373 / 24743.065 | 14950.964 / 14978.265 / 
14998.267 | 1.65193 |
   | NCLOB | 24768.535 / 24899.404 / 24962.328 | 15233.357 / 15211.568 / 
15180.218 | 1.63687 |
   
   These are **real JDBC connector-component measurements**, not full 
SeaTunnel/DataX engine benchmarks. Scheduling, split enumeration, channel 
transport and checkpointing are excluded. They do not establish a universal 
throughput difference.
   
   ### SeaTunnel version
   
   `dev` commit `ee0fb0d72f67edbcd6caf08360fd354fa68e002f`, 3.1.1-SNAPSHOT.
   DataX master: `5993b26cda90f3e6a4a2fd2e42843efeb770ab3d`.
   
   ### Environment and comparison method
   
   - Same Linux x86_64 host, 4 vCPU / 16 GiB; serial benchmark JVMs. The 
isolated Oracle XE 11.2.0.2 instance is capped at 2 CPU / 2 GiB. This is a 
shared host, not dedicated benchmark hardware.
   - Temurin 11.0.33.1, `-Xms256m -Xmx1g`; ojdbc8 12.2.0.1.0 for both tools; 
AL32UTF8 / AL16UTF16.
   - Same local MySQL 8.0.35 source, Connector/J 8.0.33, streaming read; one 
reader, one writer, no rate limit.
   - DataX uses its declared dependency versions first in its own JVM; 
SeaTunnel runs in a separate JVM with its own dependency classpath. Both use 
the same JDBC drivers.
   - Source IDs 1..1,000,000, payload `CASE WHEN MOD(id,17)=0 THEN NULL ELSE 
CONCAT('row-',id,'-\u4e2d\u6587\U0001f600\u00e9') END`; target `(ID NUMBER(19) 
PRIMARY KEY, PAYLOAD CLOB)` or NCLOB.
   - Both issue `INSERT INTO target (ID,PAYLOAD) VALUES (?,?)`, batch 1000, 
manual commit after each successful batch. SeaTunnel uses 
`commitOnFlush(true)`, batch interval 0 and retries 0. DataX row-by-row 
fallback is made fatal so it cannot silently invalidate the successful-batch 
comparison.
   - Each trial warms up with 100,000 rows, then truncates only its dedicated 
target and measures 1,000,000 rows. Trial order is DataX/SeaTunnel, 
SeaTunnel/DataX, DataX/SeaTunnel. Connection setup, reading, conversion, batch 
execution, commit and close are timed with `System.nanoTime`; destination 
reconciliation is outside the timer.
   - The actual DataX path uses `CommonRdbmsReader.Task.buildRecord` and 
`CommonRdbmsWriter.Task.startWriteWithConnection` with Oracle database type. 
The SeaTunnel path uses the MySQL row converter and 
`JdbcOutputFormatBuilder`/`JdbcOutputFormat` with `OracleDialect` and the 
correct target `sourceType`.
   - The Oracle image initially had two 10 MiB redo groups and severe 
checkpoint-incomplete waits. Those diagnostic trials were discarded; three 256 
MiB groups were added, the database configuration was frozen, and the above 
matrix was restarted from scratch. The checkpoint-incomplete wait counter 
remained unchanged during the rerun.
   
   ### Relevant source paths / investigation
   
   `OracleJdbcRowConverter` binds non-null CLOB with `setCharacterStream` and 
NCLOB with `setNCharacterStream`, while NULL uses `setNull(Types.CLOB/NCLOB)`. 
The stream handling was introduced by #10118 to prevent ORA-01461 and must be 
preserved. The typed NULL handling was introduced by #10768 
(`2bc864c172323309b980aceb9f43223386d75322`).
   
   During a SeaTunnel CLOB trial, the destination session had 1,768 SQL*Net 
round trips, 1,782 executions and 1,783 parses at only 14 committed batches / 
14,000 rows. This suggests that switching between short stream binding and 
LOB-typed NULL binding fragments driver batches. A NULL-only binding 
intervention and generated-SQL baseline are being verified before choosing the 
fix.
   
   A compatible fix must preserve long LOB streams, national-character 
handling, non-LOB typed NULLs, existing custom-SQL behavior, and other JDBC 
dialects. Arbitrarily applying a `4000/3` character threshold is not justified 
by this result.
   
   ### SeaTunnel config / running command
   
   No engine config or engine startup command was used: this is the explicit 
connector-component harness described above. The SeaTunnel sink settings are 
equivalent to `batch_size=1000`, manual commit, `max_retries=0`, explicit 
positional INSERT, and a target schema containing the native LOB type. 
Generated SQL will be checked separately.
   
   ### Error exception
   
   None. All six measured million-row copies in each type completed and passed 
exact ID/value/NULL reconciliation. This is a successful-write performance 
regression.
   
   ### Are you willing to submit a PR?
   
   Yes. I am contributing to Apache SeaTunnel and will submit a focused fix 
after the driver cause and compatibility boundaries are verified.
   


-- 
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