Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProcessPoolExecutor in CeleryExecutor should be reused #39482

Open
2 tasks done
luoyuliuyin opened this issue May 8, 2024 · 0 comments
Open
2 tasks done

ProcessPoolExecutor in CeleryExecutor should be reused #39482

luoyuliuyin opened this issue May 8, 2024 · 0 comments
Labels

Comments

@luoyuliuyin
Copy link
Contributor

Apache Airflow version

2.9.1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When the scheduler send task to celery, if there is only 1 task in the current cycle, the task will be sent to the main thread; if there are multiple tasks, a thread pool will be created based on the number of CPU cores, and then all tasks will be consumed by the thread pool.
There are some problems with the current implementation. The scheduler creates a thread pool every time it schedules, which will bring a very large performance overhead. In fact, the thread pool can be reused.
image

When I tested, sometimes it would take almost 4 seconds to consume 32 tasks.
image

What you think should happen instead?

Reuse ProcessPoolExecutor in CeleryExecutor

How to reproduce

always

Operating System

macOS

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@luoyuliuyin luoyuliuyin added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels May 8, 2024
@nathadfield nathadfield added provider:celery and removed needs-triage label for new issues that we didn't triage yet labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants