Skip to content

Rename EWYK The AdaptiveExecutionStrategy #6353

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

Merged
merged 21 commits into from
Jun 16, 2021

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jun 3, 2021

Rename EWYK to AdaptiveExecutionStrategy, which better represents the nature of the strategy.
#6391
Signed-off-by: Greg Wilkins gregw@webtide.com

Verified

This commit was signed with the committer’s verified signature.
renovate-bot Mend Renovate
Rename EWYK The AdaptiveExecutionStrategy, which better represents the nature of the strategy.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested a review from sbordet June 3, 2021 11:43
Rename EWYK The AdaptiveExecutionStrategy, which better represents the nature of the strategy.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
gregw added 8 commits June 4, 2021 09:18
Updated the documentation from review, but in so doing realised that the
sub-strategy selection could be more simply represented in code, so that was
also updated.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Updated the documentation from review, but in so doing realised that the
sub-strategy selection could be more simply represented in code, so that was
also updated.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Updated the documentation from review, but in so doing realised that the
sub-strategy selection could be more simply represented in code, so that was
also updated.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Added notes about chaining strategies and thread starvation

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Fixed formatting and made a little clearer

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Added deprecated version of EWYK

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested review from lachlan-roberts and sbordet June 4, 2021 06:03
lachlan-roberts
lachlan-roberts previously approved these changes Jun 7, 2021
Copy link
Contributor

@lachlan-roberts lachlan-roberts left a comment

Choose a reason for hiding this comment

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

LGTM

Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
gregw added 2 commits June 10, 2021 07:41
Updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
version without code duplication

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw
Copy link
Contributor Author

gregw commented Jun 9, 2021

@sbordet I have pushed a version without the lock hack that well matches the documented algorithm. Note also with this forumulation there is one less test the common case for a non-blocking task, so it will take a much simpler path.

The cost is that for the case of an potentially blocking task when there are no pending producers available, then the taskType is checked twice. This double check can be removed, but only by breaking out the EITHER and BLOCKING cases and thus duplicating the synchronized block and changing the flow from the documentation... but that may also be OK.... I'll add it as a comment to compare.

@gregw gregw requested a review from sbordet June 9, 2021 22:06
gregw added 4 commits June 10, 2021 11:13
Even more comments
Some duplicated code to avoid double test on taskType

Signed-off-by: Greg Wilkins <gregw@webtide.com>
hide the Runnable interface from the strategy signature

Signed-off-by: Greg Wilkins <gregw@webtide.com>
fix accidental change

Signed-off-by: Greg Wilkins <gregw@webtide.com>
refactor production and consumption methods to be smaller a better named/defined.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw
Copy link
Contributor Author

gregw commented Jun 10, 2021

@sbordet So I have re-re-re-reworked this class so:

  • The documentation is in the format you asked for
  • The actual code now actually matches the algorithm as described in the documentation
  • It has lots of good comments everywhere, but hopefully none that don't add value
  • the decomposition of the algorithm into methods has changed bit, giving smaller more meaningful methods (eg selectSubStrategy). Hopefully these will inlined to the same result anyway.
  • The only substantial change to the algorithm is that by first checking the taskType, then we can avoid a needless check on the thread type for PC tasks.

Considering the effort expended on a "simple" rename, please give this version fair consideration before just saying: NAH let's keep the old one

Note that I think there is some scope to manually unwind the production loop so that there is a blocking and a nonblocking version. I did give that a try, but code clarity suffered a lot and I think there would only be very marginal gains if any. The evidence is that the majority of productions are done with blocking invocations, so that path should be well optimized by the JIT without manual unwinding.

updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw linked an issue Jun 10, 2021 that may be closed by this pull request
@gregw
Copy link
Contributor Author

gregw commented Jun 12, 2021

@sbordet nudge... let's get this merged long before next release train

sbordet
sbordet previously approved these changes Jun 14, 2021
Copy link
Contributor

@sbordet sbordet left a comment

Choose a reason for hiding this comment

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

Looks good apart niggles in the comment/javadocs.

Since many javadocs were added, a general rule for javadocs is that they should be written in 3rd person, therefore "Selects a sub-strategy" rather than "Select a sub-strategy", "Runs" rather than "Run", etc.
See:
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#styleguide
https://blog.joda.org/2012/11/javadoc-coding-standards.html

niggles for javadoc

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw dismissed stale reviews from sbordet and lachlan-roberts via 8acfd44 June 14, 2021 23:17
@gregw gregw requested review from sbordet and lachlan-roberts June 15, 2021 01:42
sbordet
sbordet previously approved these changes Jun 15, 2021
Copy link
Contributor

@sbordet sbordet left a comment

Choose a reason for hiding this comment

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

Not all javadocs were put in 3rd person, it's just to have a little more consistency, but I don't want to annoy too much. LGTM.

more niggles for javadoc

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw dismissed stale reviews from sbordet and lachlan-roberts via d2dee7b June 15, 2021 12:36
@sbordet sbordet self-requested a review June 15, 2021 14:22
Fixed javadoc 3rd person forms.
Removed stale references to doProduce() method.
Using IO.close(Closeable).
Other small cosmetic changes.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@gregw
Copy link
Contributor Author

gregw commented Jun 15, 2021

@sbordet nudge

@sbordet
Copy link
Contributor

sbordet commented Jun 15, 2021

@gregw I made further changes to the javadocs, see my commit.

* @return True if the sub-strategy requires the caller to continue to produce tasks.
*/
private boolean consumeTask(Runnable task, SubStrategy subStrategy)
{
// Consume and/or execute task according to the selected mode.
if (LOG.isDebugEnabled())
LOG.debug("{} ss={} t={}/{} {}", this, subStrategy, task, Invocable.getInvocationType(task));
LOG.debug("ss={} t={}/{} {}", subStrategy, task, Invocable.getInvocationType(task), this);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbordet this is now inconsistent with the other debugs in the class.... but I guess that is not so important.

@gregw gregw merged commit a415606 into jetty-10.0.x Jun 16, 2021
@joakime joakime deleted the jetty-10.0.x-AdaptiveExecutionStrategy branch June 17, 2021 12:45
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.

Rename EatWhatYouKill to AdaptiveExecutionStrategy
3 participants