Introduce applier thread
It's reported that in master-slave setup replicas often have higher CPU usage than their replication masters. Moreover, it's easy for a replica to start falling behind the master. The reason for that is the additional work load on replica's tx thread as compared to master. While master typically splits request processing into 2 threads: iproto, which decodes the requests, and tx, which applies them, replica performs both tasks in the tx thread. This is due to replication architecture: replica handles master connection by a single fiber in the tx thread. The fiber first decodes the incoming requests and then applies them. Teach replicas to decode the incoming replication stream in a separate thread. This way tx thread doesn't waste processing time on row decoding. Each applier thread may serve several appliers, and the total number of applier threads is controlled by a new configuration option - `replication_threads`, with default value `1` (meaning, a single thread is spawned to handle all the appliers. Closes #6329 @TarantoolBot document Title: New configuration option - `replication_threads` It's now possible to specify how many threads will be spawned to decode the incoming replication stream. The default value is '1', meaning a single thread will handle all incoming replication streams. You may set the value to anything from 1 to 1000. When there are multiple replication threads, connections to serve are evenly distributed between the threads.
Showing
- changelogs/unreleased/gh-6329-applier-in-thread.md 5 additions, 0 deletionschangelogs/unreleased/gh-6329-applier-in-thread.md
- src/box/applier.cc 712 additions, 113 deletionssrc/box/applier.cc
- src/box/applier.h 88 additions, 0 deletionssrc/box/applier.h
- src/box/box.cc 16 additions, 1 deletionsrc/box/box.cc
- src/box/lua/load_cfg.lua 2 additions, 0 deletionssrc/box/lua/load_cfg.lua
- src/box/replication.cc 8 additions, 1 deletionsrc/box/replication.cc
- src/box/replication.h 6 additions, 1 deletionsrc/box/replication.h
- test/app-tap/init_script.result 1 addition, 0 deletionstest/app-tap/init_script.result
- test/box/admin.result 2 additions, 0 deletionstest/box/admin.result
- test/box/cfg.result 4 additions, 0 deletionstest/box/cfg.result
Loading
Please register or sign in to comment