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.
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