[
https://issues.apache.org/jira/browse/RATIS-836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
runzhiwang updated RATIS-836:
-----------------------------
Description:
*What's the problem ?*
Before send [normal
request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L243],
ratis client will send an [empty
request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L235]
to server to check the leader state, which cost about 5 millseconds, it's a
waste, because leader change rarely.
*How to improve ?*
I think it can be improved by send normal request directly to server, without
sending the empty request. If the server was not leader, response client with
the NotLeaderException and client retry the request. [~msingh] [~shashikant]
What do you think ? If you agree with it, I will submit an PR.
Besides one RPC call cost 5 millsecons is also weired, I will find out the root
cause.
was:
*What's the problem ?*
Before send [normal
request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L243],
ratis client will send an [empty
request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L235]
to server to check the leader state, which cost about 5 millseconds, it's a
waste, because leader change rarely.
*How to improve ?*
I think it can be improved by send normal request directly to server, without
sending the empty request. If the server was not leader, response client with
the NotLeaderException and client retry the request. [~msingh] [~shashikant]
What do you think ? If you agree with it, I will submit an PR.
> It's a waste to send an empty request to check leader state
> -----------------------------------------------------------
>
> Key: RATIS-836
> URL: https://issues.apache.org/jira/browse/RATIS-836
> Project: Ratis
> Issue Type: Improvement
> Reporter: runzhiwang
> Priority: Major
>
> *What's the problem ?*
> Before send [normal
> request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L243],
> ratis client will send an [empty
> request|https://github.com/apache/incubator-ratis/blob/master/ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java#L235]
> to server to check the leader state, which cost about 5 millseconds, it's a
> waste, because leader change rarely.
> *How to improve ?*
> I think it can be improved by send normal request directly to server, without
> sending the empty request. If the server was not leader, response client with
> the NotLeaderException and client retry the request. [~msingh] [~shashikant]
> What do you think ? If you agree with it, I will submit an PR.
> Besides one RPC call cost 5 millsecons is also weired, I will find out the
> root cause.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)