You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/12/11 20:07:20 UTC

[GitHub] [airflow] ashb opened a new pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries

ashb opened a new pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries
URL: https://github.com/apache/airflow/pull/6792
 
 
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] https://issues.apache.org/jira/browse/AIRFLOW-5930
   
   ### Description
   
   - [ ] Building the SQL string for this query takes up about 25% of the time that the DAG parsing process spends, so replacing this one query should help speed up the rate at which the scheduler can queue tasks.
   
     See https://docs.sqlalchemy.org/en/13/orm/extensions/baked.html for more info. The docs explain a lot of how/why this works, so rather than rebuilding them from string 10s of times (once per task per active dag run) we cache the build SQL string!
   
     I will collect up-to-date performance numbers against master, but this makes the "dag parsing" process of the scheduler (which creates and updates dag runs, and creates Task Instances) about 2x quicker:
   
     Concurrent DagRuns | Tasks | Before | After | Speedup
     -- | -- | -- | -- | --
     2 | 12 | 0.146s (±0.0163s) | 0.074s (±0.0037s) | x1.97
     10 | 12 | 1.11s (±0.0171s) | 0.266s (±0.0229s) | x4.17
     40 | 12 | 4.28s (±0.101s) | 0.852s (±0.0113s) | x5.02
     40 | 40 | 6.72s (±0.067s) | 2.659s (±0.0283s) | x2.53
   
   
   
   ### Tests
   
   - [x] No new tests, no change in behaviour.
   
   ### Commits
   
   - [ ] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation that describes how to use it.
     - All the public functions and the classes in the PR contain docstrings that explain what it does
     - If you implement backwards incompatible changes, please leave a note in the [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md) so we can assign it to a appropriate release
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services