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

Realize the ability to read from the replica node--Optimize read performance #176

Open
mxsm opened this issue Jul 9, 2022 · 0 comments
Open

Comments

@mxsm
Copy link
Contributor

mxsm commented Jul 9, 2022

Overall structure as follows

image

Detail as follows

Dledger Replica read logic

explain as follow

  1. When the client is constructed, a random node is selected as the node to access the data.
  2. The fetch request is sent to the selected node, and the server node receives the request to process the get entry request.
  3. Determine whether the node currently requested is the Leader, if the Leader uses the existing fetch logic directly
  4. If it is Follower, the user checks whether the requested index is greater than or equal to endIndex. If the requested index is smaller than or equal to endIndex, the user obtains an Entry corresponding to the index from the node and returns it to the client
  5. If the index is less than the endIndex, a request is sent to the Leader to obtain the endIndex of the Leader. The leader's endIndex is then compared to the index requested by the client
  6. If the index is greater than the leader endIndex, the empty entry of the client is returned directly.
  7. Index less than or equal to leader endIndex The current request waits for a certain period of time until the endIndex of the current node changes to greater than or equal to index, and then returns the corresponding Entry to the index to the client
  8. If the wait times out, return the code waiting to update the endIndex timeout to the client. (If the follower data lags too much behind the Leader, synchronization may not be completed within the specified wait time.)
  9. If the client receives the code to update the endIndex timeout, it directly goes to the Leader to obtain the data corresponding to the index.

we can get entry from leader and follower instead of from leader only. Optimize read performance and Realize the ability to read from the replica node

mxsm added a commit to mxsm/dledger that referenced this issue Jul 10, 2022
mxsm added a commit to mxsm/dledger that referenced this issue Jul 13, 2022
mxsm added a commit to mxsm/dledger that referenced this issue Jul 30, 2022
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

No branches or pull requests

1 participant