Skip to content

Conversation

@metcoder95
Copy link
Member

@metcoder95 metcoder95 commented Jun 12, 2024

metcoder95 and others added 30 commits September 13, 2023 12:59
… 6.12.0 (#453)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
src/index.ts Outdated
// We spawn if possible
// TODO: scheduler will intercept this.
if (this.workers.size < this.options.maxThreads) {
this._addNewWorker();
Copy link

@jerome-benoit jerome-benoit Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the worker histogram initialized in that case?
If a balancer query the runtime and that is initialized to zero, the balancer will wrongly pickup only new workers.
The same goes for worker recreation in the error case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each new worker, the histogram is instantiated to zero, but the whole WorkerPool has a global histogram that can be queried.

Nevertheless, to query it, you need to have a reference to the Worker Pool (Piscina instance). Maybe worth it to pass a reference to the global Piscina instance so it can query this data

Copy link

@jerome-benoit jerome-benoit Oct 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Or you can initialize to the pool one if it's not a cumulative histogram.
On poolifier, each entries init to the min of worker matching entries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be useful, I'll follow that path; thanks!


let signal: AbortSignalAny | null;
if (this.closingUp) {
if (this.closingUp || this.destroying) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between closingUp and destroying flag? I think the two can be merged.

@metcoder95
Copy link
Member Author

Thanks for the feedback @jerome-benoit, I'll kick-off the second round along the week

@metcoder95
Copy link
Member Author

@ronag I've updated the docs, feel free to take a look now 👍

@metcoder95 metcoder95 linked an issue Oct 30, 2024 that may be closed by this pull request
@metcoder95 metcoder95 force-pushed the feat/custom_balancer branch from 48b898e to 4093dfa Compare October 30, 2024 09:12
@jerome-benoit
Copy link

jerome-benoit commented Oct 30, 2024

@ronag I've updated the docs, feel free to take a look now 👍

If you are sure that no regressions are introduced by that PR, you should merge it and flag load balancer feature as experimental. Then do an alpha or beta or ... release and communicate about it to allow people to play with it and do feedbacks.

@metcoder95
Copy link
Member Author

metcoder95 commented Oct 31, 2024

Agree, that's the plan. After this is merged, I'll start issuing alpha of the new version of the library to start gathering feedback and allow people use it.

I'll reflect this in the documentation of this PR

@metcoder95
Copy link
Member Author

I'm merging now, if there's more feedback please write it here, I'll be iterating over it in upcoming PRs

Let's land and release some alpha release of the new version to get some feedback; once the Atomics implementation is also merged, I'll release the version.

@metcoder95 metcoder95 merged commit 5c42b28 into current Nov 5, 2024
10 checks passed
@metcoder95 metcoder95 deleted the feat/custom_balancer branch November 5, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More customisable scheduling

10 participants