LimSeunghyeon1 opened a new pull request, #77739:
URL: https://github.com/apache/airflow/pull/77739

   XCom and rendered task instance field upserts bind the same JSON value 
separately for insert and conflict update. This processes the same payload 
twice. Reuse the proposed insert value for those two fields; other upsert 
callers retain their existing behavior.
   
   ### Performance
   
   In a local database-level microbenchmark, median thread CPU time per 
conflict upsert was:
   
   | Database | Before | After |
   | --- | ---: | ---: |
   | SQLite 3.46.1 | 12.13 ms | 6.04 ms |
   | PostgreSQL 15.20 | 13.61 ms | 7.19 ms |
   | MySQL 8.0.46 | 20.88 ms | 10.43 ms |
   
   The benchmark used a synthetic JSON payload containing 100,000 integers and 
18 measured samples per condition. Separate instrumentation recorded two 
bind-processing calls before and one after, for both insert and conflict 
update. The timings include SQLAlchemy, driver and database execution costs, 
but exclude transaction commit time and CPU used by separate database server 
processes. The PostgreSQL benchmark uses JSON, rather than XCom's JSONB. The 
measurements do not establish an end-to-end API latency improvement.
   
   Benchmark reproduction and samples: 
https://gist.github.com/LimSeunghyeon1/043dc8830b9be9a89fb4d6ab62ea3161.
   
   ### Compatibility
   
   A custom database `BEFORE INSERT` trigger that changes a reused column can 
change the conflict-update result. For example, PostgreSQL's proposed insert 
value includes the trigger's change; previously, the independently bound update 
value retained the original value. Stateful custom bind processors can also 
observe the reduced call count.
   
   ### Validation
   
   - Regression tests: SQLite 20 passed and 1 skipped; PostgreSQL 21 passed; 
MySQL 20 passed and 1 skipped. The skipped test covers PostgreSQL trigger 
behavior.
   - Existing XCom API and rendered-field upsert tests: 6 passed per database.
   - Static checks passed, including Ruff and mypy.
   - Non-database Core tests: 6,135 passed, 12 skipped and 3 expected failures.
   - Task-instance test file on SQLite: 417 passed and 1 skipped.
   - The previously timed-out Execution API authentication cases passed on both 
the contribution branch and its exact parent.
   - The local Core database suite did not complete: the test process was 
terminated with exit code 137. Two failures shown before termination were not 
identified and remain unresolved. A subsequent run of the task-instance test 
file passed, but does not establish their cause. No patch-induced regression 
was reproduced.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Codex (GPT-6)
   
   Generated-by: Codex (GPT-6) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   Drafted-by: Codex (GPT-6); reviewed by @LimSeunghyeon1 before posting
   


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

  • [PR] Reduce JSON serialization... LimSeunghyeon1 (via GitHub) via commits

Reply via email to