Change config max tis per query#29602
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
|
Thank for your contributions. Could you describe a bit more of configurations of Airflow, your DB backend, how far it away out of Airflow services (latency), and your workload. I asked it because for me it is looks like by this PR we might replace one magic number by another. I've also found that airflow/airflow/jobs/backfill_job.py Lines 957 to 959 in aa4858d Do you know how it affects this part of code? |
|
Hi @lyso not a big deal but in the future please don't put your name in the PR title. |
I use MWAA medium class, so DB is RDS posgreSQL, 2xSchedulers run on Fargate Container with 2vCPU and 4GB RAM. Executor is CeleryExecutor via SQS. At worst case, there are 200-300 tasks scheduled at the beginning of hours. Because of the 512 During the 1-2 minutes period, the scheduler cannot make heartbeat and could be detected as inactive, then possibly causing unexpected behaviors like orphaned task adoption and task external kills. Furthermore, in case of 2 or more schedulers (HA), setting When tuning the parameter, I lowered the When submitting the value in this PR, I put the magic number as 16 as default for About
|
|
@lyso That is pretty good explanation why potentially lower value better than current |
6b33933 to
1c67920
Compare
6632c84 to
1c4d597
Compare
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
|
Commenting on this one to ensure it doesn't get aurtoclosed. It has a very nice performance enhancement! @lyso What is the current status of this PR? Looks like there are some static checks that need fixing and some tests are failing as well. @dimberman Can you have another look, your requested change has been addressed. |
You can add |
The errors has been addressed. @dimberman any comments on your feature requests? |
Let's see. Approved the run now. |
|
There are still static check problems. I recommend installing pre-commits and running them. |
|
@dimberman - it's still blocked by your "request changes". |
| # in case any of the above config not found, return directly | ||
| # this could happens in some unit tests |
There was a problem hiding this comment.
Which unit tests? We can add these to them with conf_vars.
There was a problem hiding this comment.
Here are the tests failed with this config key not found:
FAILED tests/core/test_configuration.py::TestConf::test_auth_backends_adds_session - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_values_from_conf - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_env_vars_upgraded_and_removed[old0-new0] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_env_vars_upgraded_and_removed[old1-new1] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_values_from_environ[conf_dict0] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_values_from_environ[conf_dict1] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_sections[old_config] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_sections[old_config_old_env] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_sections[old_env] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
FAILED tests/core/test_configuration.py::TestDeprecatedConf::test_deprecated_sections[new_config_old_env] - airflow.exceptions.AirflowConfigException: section/key [scheduler/max_tis_per_query] not found in config
These test cases are not using; conf_vars to initializing the conf. Instead, they initialize conf from a string directly, like test_conf = AirflowConfigParser(default_config=""). I believe it has been done for purpose.
There was a problem hiding this comment.
Can we not add the needed config to the string?
There was a problem hiding this comment.
Can we not add the needed config to the string?
Adding to their configuration string makes them dependent on this module.
These are unit tests. I don't think it's appropriate tho introduce this dependence to them.
There was a problem hiding this comment.
But the implementation those tests cover does depend on the configuration. If you do not want they to depend on it, your implementation to the config needs to be changed.
|
@dimberman you still have |
|
Closed in favor of #32572 |
This PR changes the default value for configure
scheduler.max_tis_per_queryto 16 and update related document.Before this change
scheduler.max_tis_per_query=512by default.scheduler.max_tis_per_queryshould not be greater thancore.parallelismaccording to related code [1] and [2]. If both configurations use default value, the default 512 ofmax_tis_per_queryis never used.After this PR, default will set
scheduler.max_tis_per_query=16andcore.parallelism=32. This will make the executor can be populated in two iteration of scheduler main loop.The actual change applied in Airflow runtime by this PR is to reduce the
max_tisfrom 32 to 16. The query batch size reduced. This can help scheduler finish the iteration faster. Thus make scheduler more responsive and healthy.This PR also updated related document about
scheduler.max_tis_per_queryto help users understand how to set this configuration.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.