// Generate and send a random GetValuesSingle request. func (l *Load) sendMulti(client *gen.HFileServiceClient, diff *gen.HFileServiceClient) { numKeys := int(math.Abs(rand.ExpFloat64()*10) + 1) keys := l.randomKeys(numKeys) r := &gen.SingleHFileKeyRequest{HfileName: &l.collection, SortedKeys: keys} before := time.Now() resp, err := client.GetValuesMulti(r) if err != nil { log.Println("[GetValuesMulti] Error fetching value:", err, util.PrettyKeys(keys)) } report.TimeSince(l.rtt+".overall", before) report.TimeSince(l.rtt+".getValuesMulti", before) if diff != nil { beforeDiff := time.Now() diffResp, diffErr := diff.GetValuesMulti(r) if diffErr != nil { log.Println("[GetValuesMulti] Error fetching diff value:", diffErr, util.PrettyKeys(keys)) } report.TimeSince(l.diffRtt+".overall", beforeDiff) report.TimeSince(l.diffRtt+".getValuesMulti", beforeDiff) if err == nil && diffErr == nil && !reflect.DeepEqual(resp, diffResp) { report.Inc("diffs") report.Inc("diffs.getValuesMulti") log.Printf("[DIFF-getValuesMulti] req: %v\n \torig: %v\n\n\tdiff: %v\n", r, resp, diffResp) } } }
// Generate and send a random GetValuesSingle request. func (l *Load) sendMulti(client *gen.HFileServiceClient, diff *gen.HFileServiceClient) { var wg sync.WaitGroup keys := l.randomKeys() r := &gen.SingleHFileKeyRequest{HfileName: &l.collection, SortedKeys: keys} var diffResp *gen.MultiHFileKeyResponse var diffErr error if diff != nil { wg.Add(1) go func() { defer wg.Done() beforeDiff := time.Now() diffResp, diffErr = diff.GetValuesMulti(r) if diffErr != nil { log.Println("[GetValuesMulti] Error fetching diff value:", renderErr(diffErr), util.PrettyKeys(keys)) } report.TimeSince(l.diffRtt+".overall", beforeDiff) report.TimeSince(l.diffRtt+".getValuesMulti", beforeDiff) }() } before := time.Now() resp, err := client.GetValuesMulti(r) if err != nil { log.Println("[GetValuesMulti] Error fetching value:", renderErr(err), util.PrettyKeys(keys)) } report.TimeSince(l.rtt+".overall", before) report.TimeSince(l.rtt+".getValuesMulti", before) if diff != nil { wg.Wait() if err == nil && diffErr == nil && !reflect.DeepEqual(resp, diffResp) { report.Inc("diffs") report.Inc("diffs.getValuesMulti") log.Printf("[DIFF-getValuesMulti] req: %v\n \torig: %v\n\n\tdiff: %v\n", r, resp, diffResp) } } }