[PR #3031] [v3] Perf(cnr): Optimize ComfyRegistry startup loading using incremental caching #2961

Open
opened 2026-10-28 21:14:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/3031
Author: @craftingmod
Created: 6/29/2026
Status: 🔄 Open

Base: main ← Head: fix-cache-dir


📝 Commits (10+)

  • edcfb6a Chore: Replace print to logging in cnr_utils.py
  • fb822c6 Perf(cnr): optimize ComfyRegistry loading using server-time incremental caching.
  • 62fd585 Merge branch 'main' into fix-cache-dir
  • 9a0b2c4 perf(cnr): optimize event loop blocking with asyncio.sleep and fix parameter encoding in fetch_all
  • ec2023a refactor(cnr): fix cache-miss return type consistency to empty list
  • 9a827e4 fix(cnr): eliminate client clock fallback dependency on timestamp sync
  • 5427efd perf(cnr): add cache 7-day expiration logic
  • f3c003d fix(cnr): propagate asyncio.TimeoutError in _get_cnr_data for correct bubble up
  • 5513395 fix(cnr): logical error while sync_mode = 'cache'
  • b59eb64 perf(cnr): add cache 30-days expiration logic (again)

📊 Changes

3 files changed (+217 additions, -77 deletions)

View changed files

📝 glob/cnr_utils.py (+208 -72)
📝 glob/manager_core.py (+1 -1)
📝 glob/manager_util.py (+8 -4)

📄 Description

Summary

This PR significantly optimizes the startup and reload latency of the ComfyRegistry (CNR) node loader.
By replacing the full-fetch mechanism with a server-time-based incremental sync (delta sync), it reduces the data fetched at boot time from the entire registry database (currently 4,600+ nodes across 150+ pages) to only new or updated nodes since the last run.
This reduces the ComfyRegistry sync time on startup from ~50 seconds to less than 1 second under normal conditions.

Problem

Previously, cnr_utils.py performed a full sync of the entire registry database page-by-page (limit=30, hitting the endpoint 150+ times with a time.sleep(0.5) gap) whenever it synced or when the daily cache expired. As the number of custom nodes in the registry continues to grow, this startup latency has organically degraded to over 50 seconds, creating a noticeable delay during ComfyUI boot. (Even if it runs on background, fetching process costs network request on api.comfyui.org and not avoidable until finish.)

How to implemented

https://docs.comfy.org/api-reference/registry/retrieves-a-list-of-nodes#parameter-timestamp

Integrated the timestamp parameter supported by GET https://api.comfy.org/nodes to request only nodes created or updated after the cached timestamp.

Addresses the performance issues mentioned in #2229 #1950 #1629.

Why PR

Watching every fetch of ComfyUI Nodes is painful while coding custom_nodes...
And after 1.5 years of issue is created, v4 isn't even closed to release on main branch.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/ComfyUI-Manager/pull/3031 **Author:** [@craftingmod](https://github.com/craftingmod) **Created:** 6/29/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-cache-dir` --- ### 📝 Commits (10+) - [`edcfb6a`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/edcfb6a35a491a53a7389a4989c48c96ee1d845d) Chore: Replace print to logging in `cnr_utils.py` - [`fb822c6`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/fb822c6f24b2f3f42d9dec68185aaff7a69ff55e) Perf(cnr): optimize ComfyRegistry loading using server-time incremental caching. - [`62fd585`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/62fd58524f48f6f81d005cab38aeee181875dd1d) Merge branch 'main' into fix-cache-dir - [`9a0b2c4`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/9a0b2c40f12a086230a4f03a90e2b1163b52922b) perf(cnr): optimize event loop blocking with asyncio.sleep and fix parameter encoding in fetch_all - [`ec2023a`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/ec2023a5a3cf1fea666f6c042df8b051e224c562) refactor(cnr): fix cache-miss return type consistency to empty list - [`9a827e4`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/9a827e409a5f5800829c3d794e1ab48ef0f980bf) fix(cnr): eliminate client clock fallback dependency on timestamp sync - [`5427efd`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/5427efda58cb6007f49b444836730794724441fc) perf(cnr): add cache 7-day expiration logic - [`f3c003d`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/f3c003dd202cffc4a05f298c82ed15d23a930ea7) fix(cnr): propagate asyncio.TimeoutError in _get_cnr_data for correct bubble up - [`5513395`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/5513395ace5fee241c4839fb5a542aa77cde2eec) fix(cnr): logical error while sync_mode = 'cache' - [`b59eb64`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/b59eb64c22f5b8a3bf5c62327e6d289dda129b11) perf(cnr): add cache 30-days expiration logic (again) ### 📊 Changes **3 files changed** (+217 additions, -77 deletions) <details> <summary>View changed files</summary> 📝 `glob/cnr_utils.py` (+208 -72) 📝 `glob/manager_core.py` (+1 -1) 📝 `glob/manager_util.py` (+8 -4) </details> ### 📄 Description ## Summary This PR significantly optimizes the startup and reload latency of the ComfyRegistry (CNR) node loader. By replacing the full-fetch mechanism with a `server-time-based incremental sync (delta sync)`, it reduces the data fetched at boot time from the entire registry database (currently 4,600+ nodes across 150+ pages) to only new or updated nodes since the last run. This reduces the ComfyRegistry sync time on startup from ~50 seconds to less than 1 second under normal conditions. ## Problem Previously, `cnr_utils.py` performed a full sync of the entire registry database page-by-page (limit=30, hitting the endpoint 150+ times with a `time.sleep(0.5)` gap) whenever it synced or when the daily cache expired. As the number of custom nodes in the registry continues to grow, this startup latency has organically degraded to over 50 seconds, creating a noticeable delay during ComfyUI boot. (Even if it runs on background, fetching process costs network request on `api.comfyui.org` and not avoidable until finish.) ## How to implemented https://docs.comfy.org/api-reference/registry/retrieves-a-list-of-nodes#parameter-timestamp Integrated the `timestamp` parameter supported by `GET https://api.comfy.org/nodes` to request only nodes created or updated after the cached timestamp. ## Related issues Addresses the performance issues mentioned in #2229 #1950 #1629. ## Why PR Watching every fetch of ComfyUI Nodes is painful while coding custom_nodes... And after 1.5 years of issue is created, v4 isn't even closed to release on main branch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#2961
No description provided.