[PR #375] [MERGED] feat(plugin_manager): optimize local plugin startup with concurrency #476

Closed
opened 2026-02-16 01:16:05 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/375
Author: @homejim
Created: 7/1/2025
Status: Merged
Merged: 7/8/2025
Merged by: @Yeuoly

Base: mainHead: plugin_launch_concurent


📝 Commits (7)

  • f945225 feat(plugin_manager): optimize local plugin startup with concurrent control
  • 8825b94 feat(plugin_manager): make local plugin launching concurrency configurable
  • 1fe2e51 Merge remote-tracking branch 'origin/main' into plugin_launch_concurent
  • add2213 fix(plugin_manager): optimize comment and error handling
  • 404869a refactor(plugin_manager): refactor plugin startup logic
  • e6249f8 fix(plugin_manager): Optimize plugin startup logs and concurrency control
  • 190d533 fix(plugin_manager): simplify error channel handling and semaphore release logic

📊 Changes

2 files changed (+49 additions, -22 deletions)

View changed files

📝 internal/core/plugin_manager/manager.go (+4 -3)
📝 internal/core/plugin_manager/watcher.go (+45 -19)

📄 Description

Description

This change improves the performance of local plugin initialization by introducing concurrent startup using goroutines and a semaphore for safe concurrency control.

In our Kubernetes environment, each pod start previously required sequentially fetching, compiling, and starting each plugin. With 42 plugins, this took around 10 minutes .

After this change, and using a concurrency level of 16 , plugin startup time is reduced to under 2 minutes .

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

Please provide any additional context that would help reviewers understand the changes.


🔄 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/langgenius/dify-plugin-daemon/pull/375 **Author:** [@homejim](https://github.com/homejim) **Created:** 7/1/2025 **Status:** ✅ Merged **Merged:** 7/8/2025 **Merged by:** [@Yeuoly](https://github.com/Yeuoly) **Base:** `main` ← **Head:** `plugin_launch_concurent` --- ### 📝 Commits (7) - [`f945225`](https://github.com/langgenius/dify-plugin-daemon/commit/f945225e561ea95116901d808d2fb00bee39e683) feat(plugin_manager): optimize local plugin startup with concurrent control - [`8825b94`](https://github.com/langgenius/dify-plugin-daemon/commit/8825b94c015811297e43fa17d30d27af55ff7c32) feat(plugin_manager): make local plugin launching concurrency configurable - [`1fe2e51`](https://github.com/langgenius/dify-plugin-daemon/commit/1fe2e518a844c127457eb25f3f2ecef5386140ff) Merge remote-tracking branch 'origin/main' into plugin_launch_concurent - [`add2213`](https://github.com/langgenius/dify-plugin-daemon/commit/add2213d7d19828fed5fccfaea21bd5f89b9889f) fix(plugin_manager): optimize comment and error handling - [`404869a`](https://github.com/langgenius/dify-plugin-daemon/commit/404869a33bb19917359263febefb8cde89d60ede) refactor(plugin_manager): refactor plugin startup logic - [`e6249f8`](https://github.com/langgenius/dify-plugin-daemon/commit/e6249f8b78b313537eda7ad9ed097a9ccd1b6394) fix(plugin_manager): Optimize plugin startup logs and concurrency control - [`190d533`](https://github.com/langgenius/dify-plugin-daemon/commit/190d533052a21aaa041a176f4f089538adede3a0) fix(plugin_manager): simplify error channel handling and semaphore release logic ### 📊 Changes **2 files changed** (+49 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `internal/core/plugin_manager/manager.go` (+4 -3) 📝 `internal/core/plugin_manager/watcher.go` (+45 -19) </details> ### 📄 Description ## Description This change improves the performance of local plugin initialization by introducing concurrent startup using goroutines and a semaphore for safe concurrency control. In our Kubernetes environment, each pod start previously required sequentially fetching, compiling, and starting each plugin. With 42 plugins, this took around 10 minutes . After this change, and using a concurrency level of 16 , plugin startup time is reduced to under 2 minutes . - Added config parameter to handleNewLocalPlugins for setting concurrency limit - Implemented parallel startup with controlled concurrency - Improved error handling to avoid blocking other plugins - Added logging for metrics and debugging Fixes #368 ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Refactor - [x] Performance improvement - [ ] Other ## Essential Checklist ### Testing - [x] I have tested the changes locally and confirmed they work as expected - [ ] I have added unit tests where necessary and they pass successfully ### Bug Fix (if applicable) - [x] I have used GitHub syntax to close the related issue (e.g., `Fixes #123` or `Closes #123`) ## Additional Information Please provide any additional context that would help reviewers understand the changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:05 -05:00
yindo closed this issue 2026-02-16 01:16:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#476