Skip to content

Motivated by "The load balancing issue in Poco::ActiveThreadPool" #4544#4548

Draft
bas524 wants to merge 3 commits into
pocoproject:mainfrom
bas524:activeThr-balancing
Draft

Motivated by "The load balancing issue in Poco::ActiveThreadPool" #4544#4548
bas524 wants to merge 3 commits into
pocoproject:mainfrom
bas524:activeThr-balancing

Conversation

@bas524

@bas524 bas524 commented May 7, 2024

Copy link
Copy Markdown
Contributor

Optimization allows redistribute tasks to the idle threads
When ActiveThread dequeue next Runnable, it checks is optimization is true and if yes it try to find idle thread and resend task
By default optimization is false

…project#4544"

Optimization allows redistribute tasks to the idle threads
@matejk

matejk commented May 7, 2024

Copy link
Copy Markdown
Contributor

Thanks for the contribution.

IMO partial refactoring of ActiveThreadPool (and related classes) to have a single task queue in the pool where the threads take the work from would automatically create optimal load-balancing and simplify the implementation at the same time.

@bas524

bas524 commented May 7, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for the contribution.

IMO partial refactoring of ActiveThreadPool (and related classes) to have a single task queue in the pool where the threads take the work from would automatically create optimal load-balancing and simplify the implementation at the same time.

Hi!
I thougt about it. If notificationqueue was lock-free than you proposition shoud be correct. In our case realisation with single queue would contains many locks and bad performance.
May be flat combinig implementation is better choise for us...

@andrewauclair

Copy link
Copy Markdown
Contributor

This change appears to fail with the Thread Sanitizer. The actual log has much more in it https://github.com/pocoproject/poco/actions/runs/8982526627/job/24670333088?pr=4548.

testActiveThreadLoadBalancing: ==================
WARNING: ThreadSanitizer: data race (pid=33153)
  Read of size 8 at 0x7ffe63aa0b60 by thread T16:
    #0 Poco::ActiveThread::run() <null> (libPocoFoundation.so.103+0xf9197)
    #1 <null> <null> (libPocoFoundation.so.103+0x1cc80e)
    #2 Poco::ThreadImpl::runnableEntry(void*) <null> (libPocoFoundation.so.103+0x1cdebd)

bas524 added 2 commits May 8, 2024 13:55
try increase a number of tasks and remove sleep from short-task for
tests
@matejk

matejk commented Aug 31, 2024

Copy link
Copy Markdown
Contributor

@bas524 Does the PR #4624 with different implementation that was merged to main satisfy the needs?

@bas524

bas524 commented Sep 3, 2024

Copy link
Copy Markdown
Contributor Author

@bas524 Does the PR #4624 with different implementation that was merged to main satisfy the needs?

Hi, I'll check it next week

@bas524

bas524 commented Oct 12, 2024

Copy link
Copy Markdown
Contributor Author

@bas524 Does the PR #4624 with different implementation that was merged to main satisfy the needs?

@matejk
I answered into #4624 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants