You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/02/01 17:44:00 UTC

[jira] [Commented] (AIRFLOW-6706) Lazy load operator extra links

    [ https://issues.apache.org/jira/browse/AIRFLOW-6706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17028162#comment-17028162 ] 

ASF GitHub Bot commented on AIRFLOW-6706:
-----------------------------------------

mik-laj commented on pull request #7327: [AIRFLOW-6706] Lazy load operator extra links
URL: https://github.com/apache/airflow/pull/7327
 
 
   When we import the airflow package, many modules are loaded, so I looked at what modules are exactly loaded.  I found a lot of classes that should not be loaded and delay the start of the application very much.  I suggest that some classes be loaded lazily when needed.
   
   Performance benchmark:
   ```
   seq 1 10 | xargs -n 1 -I {} time python -c "import airflow; import sys; print(len(sys.modules));"
   ```
   Before:
   ```
   1521
           3.45 real         1.83 user         0.59 sys
   1521
           1.86 real         1.60 user         0.40 sys
   1521
           1.87 real         1.61 user         0.40 sys
   1521
           1.83 real         1.60 user         0.39 sys
   1521
           1.84 real         1.62 user         0.40 sys
   1521
           2.00 real         1.71 user         0.42 sys
   1521
           1.84 real         1.60 user         0.41 sys
   1521
           1.84 real         1.60 user         0.40 sys
   1521
           1.90 real         1.64 user         0.41 sys
   1521
           1.87 real         1.61 user         0.42 sys
   ```
   After
   ```
   941
           1.79 real         0.95 user         0.27 sys
   941
           1.23 real         0.90 user         0.20 sys
   941
           1.26 real         0.90 user         0.21 sys
   941
           1.25 real         0.89 user         0.20 sys
   941
           1.25 real         0.88 user         0.20 sys
   941
           1.30 real         0.90 user         0.21 sys
   941
           1.23 real         0.88 user         0.20 sys
   941
           1.19 real         0.87 user         0.19 sys
   941
           1.23 real         0.87 user         0.21 sys
   941
           1.20 real         0.87 user         0.20 sys
   ```
   Result:
   <img width="518" alt="Screenshot 2020-02-01 at 18 42 24" src="https://user-images.githubusercontent.com/12058428/73596482-a5239a80-4522-11ea-9879-49d158264b81.png">
   
   and 580 fewer modules - 61%
   
   If anyone is interested, I attach an exact log that shows the import process.
   https://gist.github.com/mik-laj/002f5a714c221ba04bc638970094519c
   
   CC: @evgenyshulman 
   
   ---
   Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
   
   Make sure to mark the boxes below before creating PR: [x]
   
   - [X] Description above provides context of the change
   - [X] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
   - [X] Unit tests coverage for changes (not needed for documentation changes)
   - [X] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [X] Relevant documentation is updated including usage instructions.
   - [X] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   <sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   
 
----------------------------------------------------------------
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


> Lazy load operator extra links
> ------------------------------
>
>                 Key: AIRFLOW-6706
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6706
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: serialization
>    Affects Versions: 1.10.7
>            Reporter: Kamil Bregula
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)