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

Reduce OutputEventRenderer.onOutput() locking by refine lock granularity #23919

Closed
TheDadda opened this issue Feb 16, 2023 · 1 comment · Fixed by #23920
Closed

Reduce OutputEventRenderer.onOutput() locking by refine lock granularity #23919

TheDadda opened this issue Feb 16, 2023 · 1 comment · Fixed by #23920
Assignees
Labels
a:feature A new functionality in:logging
Milestone

Comments

@TheDadda
Copy link

TheDadda commented Feb 16, 2023

Expected Behavior

Reduce OutputEventRenderer.onOutput() locking by refine lock granularity

Current Behavior

Multithreading creates many lock races when finally calling OutputEventRenderer.onOutput() while logging, waiting about 500,000 times

Context

We support parallel config on our gradle version to optimizing the configuration phase time, and i found that threads were waiting for OutputEventReanderer.lock.

I try to reduce locking by refine lock granularity:

  • Remove OutputEventRenderer.lock invoked by onOutput()
  • Add synchronization logics to OutputEventTransformer class.

Lock waiting counts reduced from 50,0000 to 3k, and it can save about 4s - 6s.

Below are some screenshots during debugging:
969acbe6-b213-4d03-986b-e5a654a38ccd
ef23bb61-87c3-43ed-81df-b37cb422197d
67713e27-f0b9-4e6c-b93d-6a550a97aa42

@eskatos
Copy link
Member

eskatos commented Feb 23, 2023

Thank you for your interest in Gradle!

Thank you for the PR. The changes make sense and look good. We triggered CI validation and will follow up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:logging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants