Nodes/ComfyUI_Lam/分段负载结束
ComfyUI Node

分段负载结束

The return trip for ComfyUI's DIY load-balancer

By yanlang0123·Created 2 years ago·Updated 11 days ago· 77
分段负载结束
  • section
  • images
  • IMAGE

SectionEnd (分段负载结束, "section load end") is the closing bracket of the ComfyUI_Lam pack's distributed section-loading feature. SectionStart opens a section and waits; this node closes it and ships the processed images back through Redis. And like its counterpart, it's a transparent no-op unless you're actually running the cluster.

What it does

It takes two inputs: a section token (type SECTION, straight from SectionStart) and the images that came out of the worker part of your graph. It returns the images. That's the whole contract.

When section is None - which is what SectionStart hands you when you leave it on the "default" server - SectionEnd just passes the images straight through. Zero overhead, safe to leave wired in.

When a real section token is attached, the behavior splits depending on which side of the cluster you're on:

  • Initiator side (sectype 1): the node base64-encodes the images, writes them to Redis under the section's fileKey (plus a separate key for the tensor shape), and publishes a sectionDone event to the main channel so the waiting SectionStart knows the data is ready.
  • Worker side (sectype 0): it waits for the coordinator's done message, then reads the images back out of Redis, reshapes them using the stored shape, and returns them as a fresh IMAGE tensor.

Either way, the SECTION token is consumed and you end up with the images that traversed the cluster. The base64 + shape round-trip means the tensor comes back byte-identical, which is the whole point - a frame that went out is the same frame that comes back.

When you'd actually use it

Real talk: never, unless you've built the infrastructure. SectionStart/SectionEnd exist so one ComfyUI instance can offload a slice of a workflow to another machine, coordinated through Redis and the pack's WeChat layer, with the CLI flags (--cluster, --isSection, --isMain) that the README's 修改文件 script patches into ComfyUI core. That's a lot of moving parts - Redis, the core patch, matching config on both machines - and there's no visible community of people running it. For 99% of users this node is a wire that does nothing, and that's fine.

Installing it

It's part of the ComfyUI_Lam pack. Install via ComfyUI Manager (search "ComfyUI_Lam") or:

cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam

Then restart ComfyUI. The pack's own README targets the Windows portable build and has you run install.bat to pull its heavy requirements (which include redis). The cluster features additionally need the core-patch script from the README and Redis configured - Manager won't do any of that for you.

Troubleshooting

  • "回传数据不存在" - Redis was flushed, or the 15-second TTL on the image stash lapsed before the other side read it. Keep the round-trip fast; don't put slow work between SectionStart and SectionEnd.
  • "redis未配置" - you're using a real section but Redis isn't configured in the pack's config.
  • "主服务不存在" - the main service never registered its mainPath key in Redis. Both machines need matching config, and the coordinator has to be alive before the section starts.
  • Corrupt reads - SectionStart and SectionEnd must agree on the section token, and the fileKey round-trip is symmetric. If the two nodes don't match, you'll reshape garbage.
Categorylam

Inputs (2)

NameTypeDefaultDescription
sectionSECTION
imagesIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE