-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve Query Performance of Property Store #5375
Comments
Nice idea, can you provide some test data? How much does the optimization improve performance? |
Agree, all snapshot r/w operations are at the memory level, and very fast. It may be more convincing to provide more data, such as the ratio of In addition, all snapshots currently use the same code logic. I am curious about how to optimize the |
Property store has very little data, as it only include some constants, so why it could be traversed up to 20 times ? |
@CarlChaoCarl Why just optimize property store but not other stores? Is there any particular reasons? |
|
The main reason is that according to the data I have collected, the get frequency of the property store is relatively high, about 100,000 req/s. We optimize the get operation of the property store to improve the TPS of the transaction |
The commit operation of the snapshot is a low-frequency operation. Currently, a block is committed once at most, that is, once every 3 seconds. It increases the execution time of the block far less than the time saved by the optimization of the get operation. @xq-lu |
When the property store calls the get method, it will call the get method of SnapshotImpl. This method will traverse the snapshot linked list until the value is obtained. Because the memory block solidification requires 19 blocks, it can be traversed up to 20 times. |
According to the statistics, the get frequency of the property store is relatively high, about 100,000 req/s, and its set operation frequency is relatively low. Compared with other stores, the get frequency is not so high. Optimizing the property store can improve TPS. @guoquanwu |
OK, the following is the tps data obtained from the pressure test in the test environment
|
Can you post your pr? |
Rationale
Currently, when the get operation is performed on the snapshot of the property store, the maximum number of layers traversed by the snapshot impl is 20 times. The idea of optimization is that when a snapshot commits, it integrates the full data of the previous snapshot with the incremental data of the current snapshot so that the latest snapshot at the time of commit has the full data. In this way, during the get operation of the property store, the number of layers traversed by the snapshot will be less than or equal to 2 times.
Why should this feature exist?
Improve property store query performance and increase TPS.
Implementation
During initialization, the full data of the snapshotroot is merged into the next snapshot. When the snapshot commits, the incremental data of the current snapshot is merged with the full data in the previous snapshot.
After optimization, when the property store performs a get operation, the value can be found from the incremental data of the snapshot and the full data in the previous snapshot, so that the value can be obtained by traversing at most 2 times. Before the optimization, it needs to traverse up to 20 times to get the value. After optimization, the property store query performance is improved, thereby improving TPS.
The text was updated successfully, but these errors were encountered: