Resolver bandwidth / CPU optimization

(Ryan Worl) #1

I’ve been reading the code for the resolver to understand how it works and I noticed the resolver is receiving the mutations for each transaction, but it only appears to be using the mutations to calculate data sizes rather than any operations on the data of the mutations themselves. This makes sense given only R/W conflict ranges are relevant for conflict detection AFAIK.

If that is correct, it seems like a bandwidth/CPU-saving optimization for write-heavy workloads would be to only send the size of the mutations in each transaction or the size of each MutationRef in the transaction to the resolver rather than the MutationRefs themselves.

I was just wondering about this and have only been looking into it for about a half hour so I could easily be wrong. :sweat_smile:

1 Like
(Steve Atherton) #2

I’m not sure I understand you correctly, or perhaps you took a wrong turn in the code somewhere. A resolver needs to know the keys and key ranges being read and written within the range(s) assigned to it. For write operations, MutationRefs contain keys and key ranges in their param1 and param2 members. It sounds like you are suggesting that resolvers do not need any members of MutationRef, which is not the case, however, it is the case that resolvers do not need values and some MutationRefs use param2 as a value. I’ve never looked at this code but I was under the impression from previous discussions that values are already not being sent to resolvers.

(Ryan Worl) #3

I was under that impression as well, but here are the structs in question

ResolveTransactionBatchRequest has a vector of CommitTransactionRef.

Here is the definition of CommitTransactionRef:

The R/W conflict ranges and mutations are separate vectors (of different types). Do you need the mutations for conflict detection?

(Alex Miller) #4

Both ends deal with a CommitTransactionRef, but it doesn’t look like it’s the same one.

ResolutionRequestBuilder makes a vector of CommitTransactionRef, and then addTransaction looks like it copies the conflict ranges into them, but doesn’t copy the mutations.

1 Like