Improve mem3_sync event listener performance#19
Conversation
COUCHDB-2984
14630f6 to
8268c9a
Compare
| named_table, | ||
| {keypos,#shard.dbname}, | ||
| {read_concurrency, true} | ||
| ]), |
|
I think the frequency/delay work has merit; executing superfluous |
|
This looks like a good set of changes to me though I'm dubious whether I am My only comments concern 5bf9317:
It also feels like these new config parameters should be documented somewhere |
|
@mikewallace1979: I've added a couple of comment blocks to address your first two points. Regarding the third, see here. Configuring "bucket count" would be a more direct representation of the implementation, but I believe "delay" should be simpler for operators because it's directing behavior regardless of implementation details. |
|
@banjiewen Ah that makes sense and I agree that "delay" fits better with operator's understanding of the system than "bucket count". +1 from me. |
|
@kocolosk: Mind giving a vote on this one? |
|
+1 on the code review. I've not tested the changes myself. I understand that at least some of them have been deployed to test clusters and have yielded substantial improvements. Have all the commits been through that testing? If so, let's merge this one. |
|
@kocolosk: This exact changeset hasn't been tested, but a functionally equivalent one has; the Cloudant mem3 isn't quite in sync with the Apache mem3. Performance results were indeed quite positive. /cc @chewbranca |
In high-throughput scenarios on databases with large q values the mem3_sync event listener becomes overloaded with messages due to the poor performance of the shard selection logic. It's not strictly necessary to sync on every update, but we do need to be careful not to lose updates by keeping history too naively. This patch adds a configurable delay and push frequencyto reduce pressure on the mem3_sync event listener. COUCHDB-2984
The result of mem3_shards:for_db/1 on databases with high q values can be very large, resulting in suboptimal performance for high-volume callers. mem3_sync_event_listener is only interested in a small subset of the result of mem3_shards:for_db/1; moving this filter in to an ets:select/2 call improves performance significantly. COUCHDB-2984
This table sees a great deal of activity from various subsystems - turning on read_concurrency should be a win. COUCHDB-2984
8478c60 to
0b70afb
Compare
|
Squashed. |
There are three fundamental changes here, reflected in the latter three commits. These changes were motivated by observing and profiling mem3_sync's event listener pid during high (10k per second) write throughput load tests on databases with high (300+) q values.
We could conceivably pick and choose any of the three approaches here. The
read_concurrencyflag seems like a no-brainer and theets:select/2switch looks like a win in my limited testing.I'm ambivalent about the frequency/delay work; it turned out surprisingly subtle (to avoid dropping the "last" update on an otherwise-idle host) and required more LOC than I'd preferred, since the simplest solution wasn't compatible with the way the event listener was being spawned previously.
COUCHDB-2984