zhixinwen opened a new pull request, #3061:
URL: https://github.com/apache/kvrocks/pull/3061
Add ack mechanism in WAIT and replication logic.
When a replica sync delta change from master, it would send a `replconf ack
<sequence number>" to master.`FeedSlaveThread::staticReadCallback` will record
the ack and unblock WAIT command.
I wrote a simple loadtest script to test the setup with one master + slave
setup locally. The test has 120 concurrent workers, each calling SET with 100
bytes value:
```
Test Configuration:
Type: set
Duration: 1m0.000947872s
Concurrency: 120
Value Size: 100 bytes
Overall Statistics:
Total Requests: 4303221
Successful: 4303101 (100.00%)
Failed: 120 (0.00%)
Throughput: 71719.22 requests/second
```
If after each SET, we immediately follow a WAIT:
```
Test Configuration:
Type: set-wait
Duration: 1m0.000804367s
Concurrency: 120
Value Size: 100 bytes
Wait Replicas: 1
Overall Statistics:
Total Requests: 2237526
Successful: 2237406 (99.99%)
Failed: 120 (0.01%)
Throughput: 37291.60 requests/second
```
When I first implement this feature, I tried to be smart and did the
following:
1. When there is no client waiting, replica ACK every 1s.
2. When there is client waiting, in `incrementBatchLoopCB`, master would
send `_getack`.
3. When replica receives `_getack` , it would ack immediately.
This logic did not work well, I guess the issue is a client can send out too
many `_getack` when it is blocked. And replica is busy with processing
`_getack` instead of processing data, which makes the replication processing a
lot slower:
```
Test Configuration:
Type: set-wait
Duration: 2m0.002154771s
Concurrency: 120
Value Size: 1024 bytes
Wait Replicas: 1
Overall Statistics:
Total Requests: 22996
Successful: 21916 (95.30%)
Failed: 1080 (4.70%)
Throughput: 191.63 requests/second
```
I want to see if this mechanism is good enough for maintainers and I am open
to suggestions to make it more efficient.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]