apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37k stars 14.27k forks source link

AIP-84 Add gzip middleware to fastapi server #43640

Closed tirkarthi closed 1 hour ago

tirkarthi commented 1 day ago

Description

Fastapi provides gzip middleware to compress responses. This could be done at the load balancer level (nginx) but it will be good to have this enabled since the fastapi server mostly serves JSON responses. This can make the frontend more responsive with shorter download times. E.g. 75 dags list page results in 50kB which on adding gzip middleware becomes 5kB. There was a proposal for the same in the flask webserver which required flask compress but fastapi has this without third party packages. We use this in production for legacy webserver views and it greatly speeds up the page loading times and also makes heavy calls like log download during auto refresh more efficient.

Ref PR for legacy webserver : https://github.com/apache/airflow/pull/13517 https://fastapi.tiangolo.com/advanced/middleware/#gzipmiddleware

Use case/motivation

No response

Related issues

No response

Are you willing to submit a PR?

Code of Conduct

tirkarthi commented 1 day ago

cc: @pierrejeambrun

pierrejeambrun commented 1 day ago

Good idea, thanks.