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

[close #497] let JVM ClassLoader load gRPC error related classes during warmup #496

Merged

Conversation

marsishandsome
Copy link
Collaborator

@marsishandsome marsishandsome commented Jan 25, 2022

Signed-off-by: marsishandsome marsishandsome@gmail.com

What problem does this PR solve?

close #497

Problem Description: Request timeout when receiving NOT_LEADER error the first time.

What is changed and how it works?

The reason is that error.toString will trigger JVM ClassLoader load grpc error related classes, which costs more than 100ms.

Solution: let JVM JVM ClassLoader load grpc error related classes during warmup.

@marsishandsome marsishandsome changed the title [WIP] let JVM ClassLoader load gRPC error related classes during warmup [close #497] let JVM ClassLoader load gRPC error related classes during warmup Jan 25, 2022
@marsishandsome
Copy link
Collaborator Author

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

could you add some test?

@marsishandsome
Copy link
Collaborator Author

/run-all-tests

@marsishandsome
Copy link
Collaborator Author

could you add some test?

sure.

// let JVM ClassLoader load gRPC error related classes
// this operation may cost 100ms
Errorpb.Error.newBuilder()
.setNotLeader(Errorpb.NotLeader.newBuilder().build())
Copy link
Member

Choose a reason for hiding this comment

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

do we need to warm up other errors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All the classes (include other errors) in org.tikv.kvproto.Errorpb will be loaded during warmup.

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: marsishandsome <marsishandsome@gmail.com>
@marsishandsome
Copy link
Collaborator Author

/run-all-tests

1 similar comment
@marsishandsome
Copy link
Collaborator Author

/run-all-tests

@marsishandsome marsishandsome merged commit 6a6967a into tikv:master Jan 25, 2022
ti-srebot pushed a commit to ti-srebot/client-java that referenced this pull request Jan 25, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Collaborator

cherry pick to release-3.1 in PR #498

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.

request timeout when receiving NOT_LEADER error the first time
3 participants