Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Workers Scaling via RPC #31

Merged
merged 4 commits into from
Oct 10, 2023
Merged

Dynamic Workers Scaling via RPC #31

merged 4 commits into from
Oct 10, 2023

Conversation

butschster
Copy link
Contributor

@butschster butschster commented Oct 10, 2023

see #1728

Q A
Bugfix?
Breaks BC?
New feature? ✔️
Issues roadrunner-server/roadrunner#1728

With this new feature, developers can now scale their RoadRunner workers dynamically via RPC. We've added a Spiral\RoadRunner\WorkerPool class that provides an easy interface to add or remove workers from the RoadRunner worker pool, specifically for plugins that run in a worker mode.

Usage

Here's a quick example of how to use the new feature:

use Spiral\RoadRunner\WorkerPool;
use Spiral\Goridge\RPC\RPC;

$rpc = RPC::create('tcp://127.0.0.1:6001');
$pool = new WorkerPool($rpc);

// Add worker to the pool.
$pool->addWorker('http');

// Remove worker from the pool.
$pool->removeWorker('http');

This provides developers more control and flexibility over their RoadRunner setup, allowing for better resource allocation based on the needs of their application.

@butschster butschster added the enhancement New feature or request label Oct 10, 2023
@butschster butschster self-assigned this Oct 10, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5c22fab) 29.85% compared to head (23e2811) 48.37%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@              Coverage Diff              @@
##                3.x      #31       +/-   ##
=============================================
+ Coverage     29.85%   48.37%   +18.51%     
- Complexity       91       94        +3     
=============================================
  Files             9        9               
  Lines           211      215        +4     
=============================================
+ Hits             63      104       +41     
+ Misses          148      111       -37     
Files Coverage Δ
src/WorkerPool.php 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/WorkerPool.php Outdated Show resolved Hide resolved
src/WorkerPool.php Outdated Show resolved Hide resolved
@butschster butschster merged commit 88104bf into 3.x Oct 10, 2023
5 checks passed
@butschster butschster deleted the feature/1728 branch October 10, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants