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

[client] read submission for readonly handle should bypass OSE threads. #1804

Closed
wants to merge 2 commits into from

Conversation

sijie
Copy link
Member

@sijie sijie commented Nov 10, 2018

Descriptions of the changes in this PR:

Motivation

#1791 improves performance by bypassing OSE threads for read request submission.
however the change doesn't handle tailing ReadOnlyLedgerHandle

Changes

ReadOnlyLedgerHandle overrides isHandleWritable and return false always.


In order to uphold a high standard for quality for code contributions, Apache BookKeeper runs various precommit
checks for pull requests. A pull request can only be merged when it passes precommit checks. However running all
the precommit checks can take a long time, some trivial changes don't need to run all the precommit checks. You
can check following list to skip the tests that don't need to run for your pull request. Leave them unchecked if
you are not sure, committers will help you:

  • [skip bookkeeper-server bookie tests]: skip testing org.apache.bookkeeper.bookie in bookkeeper-server module.
  • [skip bookkeeper-server client tests]: skip testing org.apache.bookkeeper.client in bookkeeper-server module.
  • [skip bookkeeper-server replication tests]: skip testing org.apache.bookkeeper.replication in bookkeeper-server module.
  • [skip bookkeeper-server tls tests]: skip testing org.apache.bookkeeper.tls in bookkeeper-server module.
  • [skip bookkeeper-server remaining tests]: skip testing all other tests in bookkeeper-server module.
  • [skip integration tests]: skip docker based integration tests. if you make java code changes, you shouldn't skip integration tests.
  • [skip build java8]: skip build on java8. ONLY skip this when ONLY changing files under documentation under site.
  • [skip build java9]: skip build on java9. ONLY skip this when ONLY changing files under documentation under site.


Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

If this PR is a BookKeeper Proposal (BP):

  • Make sure the PR title is formatted like:
    <BP-#>: Description of bookkeeper proposal
    e.g. BP-1: 64 bits ledger is support
  • Attach the master issue link in the description of this PR.
  • Attach the google doc link if the BP is written in Google Doc.

Otherwise:

  • Make sure the PR title is formatted like:
    <Issue #>: Description of pull request
    e.g. Issue 123: Description ...
  • Make sure tests pass via mvn clean apache-rat:check install spotbugs:check.
  • Replace <Issue #> in the title with the actual Issue number.

*Motivation*

apache#1791 improves performance by bypassing OSE threads for read request submission.
however the change doesn't handle `tailing` ReadOnlyLedgerHandle

*Changes*

ReadOnlyLedgerHandle overrides `isHandleWritable` and return `false` always.
@sijie
Copy link
Member Author

sijie commented Nov 10, 2018

@nicmichael can you please review this PR to see if that matches your intention at #1791 ?

@eolivelli
Copy link
Contributor

In client tests there are a lot of failure around fencing.
This is quite scary

@sijie
Copy link
Member Author

sijie commented Nov 11, 2018

retest this please

1 similar comment
@eolivelli
Copy link
Contributor

retest this please

@eolivelli
Copy link
Contributor

there are still a lot of errors

@nicmichael
Copy link
Contributor

@sijie Yes that was the intention.
I'm looking at the test failures now. Adding "|| isRecoveryRead" to isHandleWritable() in readEntriesInternalAsync seems to address some, but not all of the failures. I don't quite understand yet what's causing the failures.

@eolivelli
Copy link
Contributor

maybe the errors on recovery are due to the fact that reads should strictly respect the order

@nicmichael
Copy link
Contributor

During recovery I suppose they should...
In the absence of a recovery on a read-only LH, they don't need to, and getting rid of the ordering (and the context-switch) is a noticeable performance win. So the trick is to correctly distinguish these scenarios. Guess that's still not right.

@sijie
Copy link
Member Author

sijie commented Nov 12, 2018

yeah. I think we don't this change. we should just close it.

@sijie sijie closed this Nov 12, 2018
@nicmichael
Copy link
Contributor

I think what we need is something like this:

        if (isHandleWritable() || metadata.isInRecovery()) { 
            // Ledger handle in read/write mode: submit to OSE for ordered execution.
            clientCtx.getMainWorkerPool().executeOrdered(ledgerId, op);
        } else {
            // Read-only ledger handle: bypass OSE and execute read directly in client thread.
            // This avoids a context-switch to OSE thread and thus reduces latency.
            op.run();
        }

It passes tests on my workstation. I'm just not quite sure whether this check needs any synchronization or can go without.

@sijie
Copy link
Member Author

sijie commented Nov 12, 2018

@nicmichael I think it is a bit risky to take recovery state into account. so I would rather rely on whether metadata is closed or not. that says, the check in current master is probably good enough for the cases we are targeting.

@nicmichael
Copy link
Contributor

Sounds good to me. The most common case is probably addressed by the earlier change.

@sijie sijie deleted the readonly_handle_isnot_writable branch November 13, 2018 06:12
@eolivelli
Copy link
Contributor

Okay, we don't need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants