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

webserver static file caching is disabled above 2.3.0 version. #39344

Closed
2 tasks done
VertexToEdge opened this issue May 1, 2024 · 2 comments · Fixed by #39345
Closed
2 tasks done

webserver static file caching is disabled above 2.3.0 version. #39344

VertexToEdge opened this issue May 1, 2024 · 2 comments · Fixed by #39345
Labels
area:webserver Webserver related Issues good first issue kind:bug This is a clearly a bug

Comments

@VertexToEdge
Copy link
Contributor

Apache Airflow version

Other Airflow 2 version (please specify below)

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

2.3.x ~ 2.9.x

What happened?

Recently, I migrated airflow version 2.2.0 to 2.9.0 and python 3.8 to 3.12.

and i experienced too much load time in airflow web dashboard.
in airflow 2.2.0, airflow dashboard loaded almost instantly. but in 2.9.0, it tooks almost 10 seconds.

Airflow 2.2.0

image

Airflow 2.9.0

image

What you think should happen instead?

I think there is no reason to make slow page loading time because of not using static file caching.

And I figured out the root cause. the problem is airflow webserver's caching is disabled because of bumping up Flask version 1.x to 2.x.

In Flask, there is Configuration Option for static file's Expire time for cache-control.
it is SEND_FILE_MAX_AGE_DEFAULT.

In Flask 1.1.x, the default value of SEND_FILE_MAX_AGE_DEFAULT is 12 hours.
https://flask.palletsprojects.com/en/1.1.x/api/#flask.Flask.send_file_max_age_default
image

After Flask 2.0.x, the default value of SEND_FILE_MAX_AGE_DEFAULT is changed to None.
https://flask.palletsprojects.com/en/2.0.x/api/#flask.Flask.send_file_max_age_default
image

after Airflow 2.3.0, Flask version is upgraded to 2.0.x.

When i added flask configuration in app.py
static file caching works well.
image
290_with_caching
example is here. https://github.com/VertexToEdge/airflow-docker-compose

How to reproduce

I followed setup instruction in https://airflow.apache.org/docs/apache-airflow/stable/howto/docker-compose/index.html

  1. Setup Airflow 2.9.0 with docker-compose
curl -LfO 'https://airflow.apache.org/docs/apache-airflow/2.9.0/docker-compose.yaml'
AIRFLOW_UID=$(id -u) docker compose up
  1. access airflow webserver with webbrowser. and refresh the page.

Operating System

Ubuntu 22.04.3 LTS

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else?

I am newbie in Airflow.
I read airflow installation guide and configruation reference. but I'm not sure if there is a better way to do this without changing the code.
Is there any way to configure static file caching? please just talk to me.

thanks for reading. have a good day.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@VertexToEdge VertexToEdge 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 1, 2024
Copy link

boring-cyborg bot commented May 1, 2024

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@Taragolis Taragolis added area:webserver Webserver related Issues and removed needs-triage label for new issues that we didn't triage yet area:core labels May 1, 2024
@Taragolis
Copy link
Contributor

if there is a better way to do this without changing the code

Better way contribute this changes to Airflow codebase. I do not sure that you could provide additional configurations without modification the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues good first issue kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants