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

Fix ResourceTracker in benchmark to work fine with VIRTUAL_THREAD #234

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

kawamuray
Copy link
Member

No description provided.

Copy link
Member

@ocadaruma ocadaruma left a comment

Choose a reason for hiding this comment

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

Thank you for the fix.
Left two questions.

String name = threadInfo.getThreadName();
log.debug("Tracking target check for thread name: {}", name);
if (name.startsWith("DecatonSubscriptionThread-") || name.startsWith("PartitionProcessorThread-") ||
subPartitionRuntime == SubPartitionRuntime.VIRTUAL_THREAD && name.startsWith("ForkJoinPool-")) {
Copy link
Member

Choose a reason for hiding this comment

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

So if we have another fork join pool (though currently we don't) in benchmark runtime or somewhere, it may be miscounted as the resource usage.

I think it's acceptable compromise for now though, can we identify virtual thread runtime's pool more precisely somehow? (e.g. by customizing carrier thread's thread factory?)

Copy link
Member Author

Choose a reason for hiding this comment

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

None without any sorts of dirty work :(

Copy link
Member

Choose a reason for hiding this comment

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

I see, thanks. The only way I can imagine (substituting VirtualThread's scheduler by accessing package-private class) is also dirty so let's do in current way for now

ScheduledExecutorService executor = Executors.newScheduledThreadPool(
1, Thread.ofPlatform().daemon().factory());
executor.scheduleAtFixedRate(() -> {
for (int i = 0; i < Runtime.getRuntime().availableProcessors(); i++) {
Copy link
Member

Choose a reason for hiding this comment

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

Does submitting tasks up to availableProcessors count ensure keeping all ForkJoinPool worker thread to keep alive?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it worked based on my observation.

@ocadaruma ocadaruma merged commit 0050311 into line:master Apr 16, 2024
5 checks passed
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.

None yet

2 participants