ephraimbuddy commented on code in PR #69815:
URL: https://github.com/apache/airflow/pull/69815#discussion_r4455901616


##########
airflow-core/src/airflow/models/dagbag.py:
##########
@@ -236,6 +236,22 @@ def get_latest_version_of_dag(self, dag_id: str, *, 
session: Session) -> Seriali
 
         if not (serdag := SerializedDagModel.get(dag_id, session=session)):

Review Comment:
   Not blocking, fine as a follow-up: a hit still loads the full row, and 
`_data` is a JSON column, so the driver parses the whole payload on every 
request. That's likely most of the 1–4 ms left in your "after" numbers. 
Selecting only `dag_version_id`/`dag_hash` first, or deferring 
`_data`/`_data_compressed` so they lazy-load on a miss, would make hits close 
to free.



##########
airflow-core/docs/faq.rst:
##########
@@ -726,13 +726,17 @@ this in the ``[api]`` section:
     dag_cache_ttl = 3600   ; seconds before a cached entry expires (0 = no TTL)
 
 ``dag_cache_size`` is the only hard ceiling on memory. An entry's TTL is 
refreshed only when the entry is
-checked against the database after ``[core] 
min_serialized_dag_update_interval``, not on every request.
-With a shorter TTL, even frequently requested entries can expire and reload 
between checks. Setting both
+checked against the database: on every lookup by Dag ID, or after
+``[core] min_serialized_dag_update_interval`` for version-specific lookups.
+With a shorter TTL, even frequently requested versions can expire and reload 
between checks. Setting both

Review Comment:
   "Between checks" now covers two cases, and the TTL caveat only applies to 
version-specific lookups; by-Dag-ID lookups refresh the TTL on every request. 
Could you say that explicitly?



##########
airflow-core/src/airflow/config_templates/config.yml:
##########
@@ -1783,14 +1782,15 @@ api:
         database on next access. Set to 0 to disable TTL, leaving eviction to 
the
         ``dag_cache_size`` LRU policy.
 
-        An entry's TTL is refreshed only when the entry is checked against the 
database after
-        ``[core] min_serialized_dag_update_interval``, not on every request. 
If the TTL is shorter
-        than that interval, even frequently requested entries can expire and 
reload between
-        checks. ``dag_cache_size`` remains the only hard ceiling on memory.
+        An entry's TTL is refreshed only when the entry is checked against the 
database: on
+        every lookup by Dag ID, or after ``[core] 
min_serialized_dag_update_interval`` for
+        version-specific lookups. If the TTL is shorter than that interval, 
even frequently

Review Comment:
   Same here: "that interval" now follows a sentence naming two cases. Suggest 
"If the TTL is shorter than `[core] min_serialized_dag_update_interval`, 
frequently requested versions can still expire and reload between 
version-specific checks."



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to