|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## 1.6.2 |
| 4 | + |
| 5 | +**What's New:** |
| 6 | + |
| 7 | +* **MultiWorkflowPool** – Event-driven heterogeneous cluster management for ComfyUI workers |
| 8 | + * Manage pools of ComfyUI servers with different workflow capabilities (e.g., SDXL servers, Flux servers, ControlNet servers) |
| 9 | + * **Workflow Affinity Routing** – Automatically route jobs to servers with matching workflow capabilities based on workflow hash |
| 10 | + * **Zero Polling Architecture** – Fully event-driven design with no polling loops for maximum responsiveness and scalability |
| 11 | + * **Per-Workflow Queues** – Separate job queues per workflow type with intelligent fallback to general queue |
| 12 | + * **Client Priority System** – Configure server priority for workflow assignments |
| 13 | + * **Structured Logging** – Built-in logger with configurable log levels (`debug`, `info`, `warn`, `error`, `silent`) |
| 14 | + * **Integrated Profiling** – Optional per-node execution profiling adapted from WorkflowPool |
| 15 | + * **Progress & Preview Events** – Real-time job progress tracking and preview image streaming |
| 16 | + * **Smart Client Management** – Automatic idle/busy state tracking and failover handling |
| 17 | + |
| 18 | +**Architecture:** |
| 19 | + |
| 20 | +```typescript |
| 21 | +const pool = new MultiWorkflowPool({ |
| 22 | + logLevel: "info", // Structured logging |
| 23 | + enableProfiling: true, // Per-node timing stats |
| 24 | + enableMonitoring: true, // Periodic status summaries |
| 25 | + connectionTimeoutMs: 10000 // Connection timeout per client |
| 26 | +}); |
| 27 | + |
| 28 | +// Add clients with workflow affinity |
| 29 | +pool.addClient("http://server1:8188", { |
| 30 | + workflowAffinity: [sdxlWorkflow], // Routes SDXL jobs here |
| 31 | + priority: 1 |
| 32 | +}); |
| 33 | + |
| 34 | +pool.addClient("http://server2:8188", { |
| 35 | + workflowAffinity: [fluxWorkflow], // Routes Flux jobs here |
| 36 | + priority: 2 |
| 37 | +}); |
| 38 | + |
| 39 | +await pool.init(); |
| 40 | + |
| 41 | +// Submit jobs - automatic routing to appropriate server |
| 42 | +const jobId = await pool.submitJob(sdxlWorkflow); |
| 43 | + |
| 44 | +// Track progress and get results |
| 45 | +pool.attachJobProgressListener(jobId, ({ value, max }) => { |
| 46 | + console.log(`Progress: ${Math.round(value/max*100)}%`); |
| 47 | +}); |
| 48 | + |
| 49 | +const result = await pool.waitForJobCompletion(jobId); |
| 50 | +console.log('Profile Stats:', result.profileStats); |
| 51 | +``` |
| 52 | + |
| 53 | +**Key Features:** |
| 54 | + |
| 55 | +* **ClientRegistry** – Manages client connections, states (idle/busy/offline), and workflow affinity matching |
| 56 | +* **JobQueueProcessor** – Per-workflow queue processing with event-driven job assignment |
| 57 | +* **JobStateRegistry** – Centralized job lifecycle management with profiling integration |
| 58 | +* **PoolEventManager** – Extensible event system for custom monitoring and integration |
| 59 | + |
| 60 | +**Events Supported:** |
| 61 | + |
| 62 | +* Job lifecycle: `job:queued`, `job:started`, `job:completed`, `job:failed`, `job:cancelled` |
| 63 | +* Progress tracking: Real-time progress updates with node execution tracking |
| 64 | +* Preview streaming: `b_preview_meta` events with blob and metadata |
| 65 | +* Client state: Automatic idle/busy transitions, offline detection |
| 66 | + |
| 67 | +**Performance:** |
| 68 | + |
| 69 | +* Event-driven architecture eliminates polling overhead |
| 70 | +* O(1) workflow hash lookup for client routing |
| 71 | +* Separate queues prevent head-of-line blocking |
| 72 | +* Profiling shows cache hit rates, node timing, and execution bottlenecks |
| 73 | + |
| 74 | +**Documentation:** |
| 75 | + |
| 76 | +* `docs/multipool-profiling.md` – Profiling guide for MultiWorkflowPool |
| 77 | +* `src/multipool/tests/profiling-demo.ts` – Complete profiling demonstration |
| 78 | +* `src/multipool/tests/two-stage-edit-simulation.ts` – Multi-user workflow simulation |
| 79 | + |
| 80 | +**New Exports:** |
| 81 | + |
| 82 | +* `MultiWorkflowPool` – Main pool class |
| 83 | +* `JobProfiler` – Per-job execution profiling (MultiWorkflowPool variant) |
| 84 | +* `Logger` / `createLogger` – Structured logging infrastructure |
| 85 | +* Types: `MultiWorkflowPoolOptions`, `JobResults`, `JobState`, `JobProfileStats` |
| 86 | + |
| 87 | +**Use Cases:** |
| 88 | + |
| 89 | +* Multi-tenant SaaS platforms with heterogeneous server capabilities |
| 90 | +* Workflow-specific server pools (image generation, video, upscaling, etc.) |
| 91 | +* Development/testing with mixed local and cloud ComfyUI instances |
| 92 | +* Load balancing across geographically distributed servers |
| 93 | + |
3 | 94 | ## 1.5.0 |
4 | 95 |
|
5 | 96 | **What's New:** |
|
0 commit comments