Skip to content

[Feature] Request to revisit VirtualThreadPool optimization: Potential benchmark methodology issue #16174

@moooonk

Description

@moooonk

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Apache Dubbo Component

Java SDK (apache/dubbo)

Descriptions

Summary
While reviewing the VirtualThreadPool refactoring (#16042, merged via #16055), I noticed a potential issue in the benchmark methodology that may have affected the performance conclusions. I'd like to bring this to the attention of the original authors and reviewers for re-evaluation.

Observation
In the benchmark code referenced in the discussion, there is a comment indicating a correction:

countDownLatch2.await(); // Fixed: should await countDownLatch2 (not the first one)
I ran some tests and found that:

When correctly awaiting countDownLatch2, the non-pooled approach (Executors.newThreadPerTaskExecutor) appears to show better performance
The pooled approach only appeared faster when the benchmark was using the incorrect latch (countDownLatch1)
This suggests the performance comparison may have been affected by synchronization timing issues rather than actual execution efficiency.

Questions
@funky-eyes @heliang666s @RainYuY @zrlw — Could you help verify:

Was the benchmark data in #16042 collected before or after the latch fix?
Would it be possible to re-run the benchmark with the corrected synchronization to confirm the results?

Suggestion
Given that the pooled implementation adds configuration complexity (THREADS_VIRTUAL_CORE), it would be valuable to ensure the performance benefits are validated with the correct measurement approach. I'm happy to assist with re-testing if needed.

Thank you for your time and for the work on this feature. Looking forward to your thoughts.

Related issues

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions