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

Option to change groupers count in ConcurrencyGrouper to avoid contention #15228

Closed
takaaki7 opened this issue Oct 22, 2023 · 4 comments
Closed

Comments

@takaaki7
Copy link

Description

For my workload, ConcurrencyGrouper's synchronized (subGrouper) { causes many contention and becomes bottleneck.
https://github.com/takaaki7/druid/blob/37853f8de4ba801a5f6c429ccceeb58b58762109/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ConcurrentGrouper.java#L290

It seems just increasing groupers can reduce contentions and improve the performance.

Test description

Query

SELECT COUNT(*) AS (SELECT user_id, COUNT(*) AS cnt
FROM event_log
)
WHERE cnt > 100

Input: 600M rows
Intermediate grouping result rows: 20M rows(not filtered by WHERE clause)
Threads: 23 (24core machine)
Latency: 3-4sec

I debugged with jstack and many times threads are stopped at synchronized (subGrouper) { line.

@gianm
Copy link
Contributor

gianm commented Oct 26, 2023

Does it help if you set mergeThreadLocal: true? This removes the synchronization completely.

@takaaki7
Copy link
Author

Now I tested and here is the result.
#15227 (comment)

mergeThreadLocal is faster, but the aggregation result is wrong.

Copy link

github-actions bot commented Aug 5, 2024

This issue has been marked as stale due to 280 days of inactivity.
It will be closed in 4 weeks if no further activity occurs. If this issue is still
relevant, please simply write any comment. Even if closed, you can still revive the
issue at any time or discuss it on the dev@druid.apache.org list.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 5, 2024
Copy link

github-actions bot commented Sep 2, 2024

This issue has been closed due to lack of activity. If you think that
is incorrect, or the issue requires additional review, you can revive the issue at
any time.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants