Comfy-Org / Comfy-Org/ComfyUI

python server optimizations?

Open
#8,346 0 comments 2 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Expected Behavior

Comfy UI with lots of nodes working behind reverse proxy with higher stability

### Actual Behavior

Comfy UI with custom nodes becomes very unstable when behind proxy - 404 not founds, lots of concurrent api requests also take the server down for some reason.
There is no clear guide related to setting up a proxy which would be stable with lots of custom nodes.

### Steps to Reproduce

```
git clone https://github.com/comfyanonymous/ComfyUI docker/comfyui/ComfyUI/
git clone https://github.com/ltdrdata/ComfyUI-Manager docker/comfyui/ComfyUI/custom_nodes/comfyui-manager
git clone https://github.com/chrisgoringe/cg-use-everywhere docker/comfyui/ComfyUI/custom_nodes/cg-use-everywhere
git clone https://github.com/Fannovel16/comfyui_controlnet_aux docker/comfyui/ComfyUI/custom_nodes/comfyui_controlnet_aux
git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus docker/comfyui/ComfyUI/custom_nodes/comfyui_ipadapter_plus
git clone https://github.com/john-mnz/ComfyUI-Inspyrenet-Rembg docker/comfyui/ComfyUI/custom_nodes/comfyui-inspyrenet-rembg
git clone https://github.com/westNeighbor/ComfyUI-ultimate-openpose-editor docker/comfyui/ComfyUI/custom_nodes/ComfyUI-ultimate-openpose-editor
git clone https://github.com/Gourieff/ComfyUI-ReActor docker/comfyui/ComfyUI/custom_nodes/comfyui-reactor-node
git clone https://github.com/lquesada/ComfyUI-Inpaint-CropAndStitch docker/comfyui/ComfyUI/custom_nodes/comfyui-inpaint-cropandstitch
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack docker/comfyui/ComfyUI/custom_nodes/comfyui-impact-pack
git clone https://github.com/ltdrdata/ComfyUI-Impact-Subpack docker/comfyui/ComfyUI/custom_nodes/comfyui-impact-subpack
git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes docker/comfyui/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes
git clone https://github.com/PowerHouseMan/ComfyUI-AdvancedLivePortrait docker/comfyui/ComfyUI/custom_nodes/comfyui-advancedliveportrait
git clone https://github.com/XLabs-AI/x-flux-comfyui docker/comfyui/ComfyUI/custom_nodes/x-flux-comfyui
git clone https://github.com/crystian/ComfyUI-Crystools docker/comfyui/ComfyUI/custom_nodes/ComfyUI-Crystools
git clone https://github.com/twri/sdxl_prompt_styler docker/comfyui/ComfyUI/custom_nodes/sdxl_prompt_styler
git clone https://github.com/rgthree/rgthree-comfy docker/comfyui/ComfyUI/custom_nodes/rgthree-comfy
git clone https://github.com/cubiq/ComfyUI_essentials docker/comfyui/ComfyUI/custom_nodes/comfyui_essentials
git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts docker/comfyui/ComfyUI/custom_nodes/comfyui-custom-scripts
git clone https://github.com/kijai/ComfyUI-LBMWrapper docker/comfyui/ComfyUI/custom_nodes/ComfyUI-LBMWrapper
git clone https://github.com/sipherxyz/comfyui-art-venture docker/comfyui/ComfyUI/custom_nodes/comfyui-art-venture
git clone https://github.com/lum3on/comfyui_LLM_Polymath docker/comfyui/ComfyUI/custom_nodes/llm_polymath
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite docker/comfyui/ComfyUI/custom_nodes/comfyui-videohelpersuite
git clone https://github.com/SamTyurenkov/comfyui_chatgpt docker/comfyui/ComfyUI/custom_nodes/comfyui_chatgpt
git clone https://github.com/yolain/ComfyUI-Easy-Use docker/comfyui/ComfyUI/custom_nodes/comfyui-easy-use
git clone https://github.com/calcuis/gguf docker/comfyui/ComfyUI/custom_nodes/gguf
git clone https://github.com/city96/ComfyUI-GGUF docker/comfyui/ComfyUI/custom_nodes/ComfyUI-GGUF

python3.12 -m ensurepip && python3.12 -m pip install virtualenv
virtualenv -p python3.12 docker/comfyui/venv
source docker/comfyui/venv/bin/activate;

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu128
pip install -U albumentations==2.0.6 diffusers numpy==2.0 xformers insightface transparent-background -r docker/comfyui/ComfyUI/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui_controlnet_aux/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/ComfyUI-ultimate-openpose-editor/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-impact-pack/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-impact-subpack/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-advancedliveportrait/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/ComfyUI-Crystools/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/ComfyUI-LBMWrapper/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-art-venture/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/llm_polymath/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-videohelpersuite/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui_chatgpt/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/comfyui-easy-use/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/gguf/requirements.txt
pip install -r docker/comfyui/ComfyUI/custom_nodes/ComfyUI-GGUF/requirements.txt
docker/comfyui/venv/bin/python docker/comfyui/ComfyUI/custom_nodes/x-flux-comfyui/setup.py
pip install torchsde aiohttp onnxruntime-gpu
pip install flet==0.27.6 matplotlib-inline albumentations==2.0.6 spandrel kornia av transparent-background
```

### Debug Logs

```powershell
At some point app starts getting timeouts, lots of 524 error

And in logs:
send error: Cannot write to closing transport
send error: Cannot write to closing transport
send error: Cannot write to closing transport
send error: Cannot write to closing transport
send error: Cannot write to closing transport
send error: Cannot write to closing transport
```

### Other

Without custom nodes it works well

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.