airflow-core/docs/howto/performance.rst
.. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This guide collects pragmatic tips that improve Airflow performance for API and UI workloads.
If you observe slowness in some API calls or specific UI views, you should inspect query plans and add indexes yourself that match your workload. Listing endpoints and UI table views with specific ordering criteria are likely to benefit from additional indexes if you have a large volume of metadata.
When to use ^^^^^^^^^^^
start_date, timestamps (e.g. dttm), or status fields.Guidance ^^^^^^^^
EXPLAIN/EXPLAIN ANALYZE) for slow endpoints and identify missing indexes.order_by
query parameter used in API calls. Composite indexes can cover multi criteria ordering.Upgrade considerations ^^^^^^^^^^^^^^^^^^^^^^
To avoid conflicts with Airflow database upgrades, delete your custom indexes before running an Airflow DB upgrade and re-apply them after the upgrade succeeds.
Notes ^^^^^
EXPLAIN) to choose effective column sets and ordering for your workload.Browsers limit concurrent HTTP/1.1 connections to six per origin. Views such as the Grid page can issue many API requests at once, causing some of them to queue and stall until a connection slot becomes available.
Enabling HTTP/2 at the reverse-proxy layer (e.g. Nginx) removes this limitation because HTTP/2 multiplexes many requests over a single TCP connection.
Benefits ^^^^^^^^
How to enable ^^^^^^^^^^^^^
HTTP/2 is configured on the reverse proxy that sits in front of the Airflow API server.
For Nginx, add the http2 directive to the listen line:
.. code-block:: nginx
server {
listen 443 ssl http2;
# ... existing Airflow proxy configuration ...
}
For details on running Airflow behind a reverse proxy, see
:doc:/howto/run-behind-proxy.