@@ -166,8 +166,6 @@ static void config_init_defaults(struct benchmark_config *cfg)
166
166
cfg->protocol = " redis" ;
167
167
if (!cfg->run_count )
168
168
cfg->run_count = 1 ;
169
- if (!cfg->requests && !cfg->test_time )
170
- cfg->requests = 10000 ;
171
169
if (!cfg->clients )
172
170
cfg->clients = 50 ;
173
171
if (!cfg->threads )
@@ -188,6 +186,14 @@ static void config_init_defaults(struct benchmark_config *cfg)
188
186
cfg->key_pattern = " R:R" ;
189
187
if (!cfg->data_size_pattern )
190
188
cfg->data_size_pattern = " R" ;
189
+ if (cfg->requests == (unsigned int )-1 ) {
190
+ cfg->requests = cfg->key_maximum - cfg->key_minimum ;
191
+ if (strcmp (cfg->key_pattern , " P:P" )==0 )
192
+ cfg->requests = cfg->requests / (cfg->clients * cfg->threads ) + 1 ;
193
+ printf (" setting requests to %d\n " , cfg->requests );
194
+ }
195
+ if (!cfg->requests && !cfg->test_time )
196
+ cfg->requests = 10000 ;
191
197
}
192
198
193
199
static int config_parse_args (int argc, char *argv[], struct benchmark_config *cfg)
@@ -334,14 +340,18 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
334
340
break ;
335
341
case ' n' :
336
342
endptr = NULL ;
337
- cfg->requests = (unsigned int ) strtoul (optarg , &endptr, 10 );
338
- if (!cfg->requests || !endptr || *endptr != ' \0 ' ) {
339
- fprintf (stderr, " error: requests must be greater than zero.\n " );
340
- return -1 ;
341
- }
342
- if (cfg->test_time ) {
343
- fprintf (stderr, " error: --test-time and --requests are mutually exclusive.\n " );
344
- return -1 ;
343
+ if (strcmp (optarg , " allkeys" )==0 )
344
+ cfg->requests = -1 ;
345
+ else {
346
+ cfg->requests = (unsigned int ) strtoul (optarg , &endptr, 10 );
347
+ if (!cfg->requests || !endptr || *endptr != ' \0 ' ) {
348
+ fprintf (stderr, " error: requests must be greater than zero.\n " );
349
+ return -1 ;
350
+ }
351
+ if (cfg->test_time ) {
352
+ fprintf (stderr, " error: --test-time and --requests are mutually exclusive.\n " );
353
+ return -1 ;
354
+ }
345
355
}
346
356
break ;
347
357
case ' c' :
@@ -483,8 +493,8 @@ static int config_parse_args(int argc, char *argv[], struct benchmark_config *cf
483
493
case o_key_pattern:
484
494
cfg->key_pattern = optarg ;
485
495
if (strlen (cfg->key_pattern ) != 3 || cfg->key_pattern [1 ] != ' :' ||
486
- (cfg->key_pattern [0 ] != ' R' && cfg->key_pattern [0 ] != ' S' && cfg->key_pattern [0 ] != ' G' ) ||
487
- (cfg->key_pattern [2 ] != ' R' && cfg->key_pattern [2 ] != ' S' && cfg->key_pattern [2 ] != ' G' )) {
496
+ (cfg->key_pattern [0 ] != ' R' && cfg->key_pattern [0 ] != ' S' && cfg->key_pattern [0 ] != ' G' && cfg-> key_pattern [ 0 ] != ' P ' ) ||
497
+ (cfg->key_pattern [2 ] != ' R' && cfg->key_pattern [2 ] != ' S' && cfg->key_pattern [2 ] != ' G' && cfg-> key_pattern [ 2 ] != ' P ' )) {
488
498
fprintf (stderr, " error: key-pattern must be in the format of [S/R/G]:[S/R/G].\n " );
489
499
return -1 ;
490
500
}
@@ -550,6 +560,7 @@ void usage() {
550
560
" \n "
551
561
" Test Options:\n "
552
562
" -n, --requests=NUMBER Number of total requests per client (default: 10000)\n "
563
+ " use 'allkeys' to run on the entire key-range\n "
553
564
" -c, --clients=NUMBER Number of clients per thread (default: 50)\n "
554
565
" -t, --threads=NUMBER Number of threads (default: 4)\n "
555
566
" --test-time=SECS Number of seconds to run the test\n "
@@ -587,7 +598,10 @@ void usage() {
587
598
" --key-minimum=NUMBER Key ID minimum value (default: 0)\n "
588
599
" --key-maximum=NUMBER Key ID maximum value (default: 10000000)\n "
589
600
" --key-pattern=PATTERN Set:Get pattern (default: R:R)\n "
590
- " G for Gaussian distribution, R for uniform Random, S for Sequential\n "
601
+ " G for Gaussian distribution.\n "
602
+ " R for uniform Random.\n "
603
+ " S for Sequential.\n "
604
+ " P for Parallel (Sequential were each client has a subset of the key-range).\n "
591
605
" --key-stddev The standard deviation used in the Gaussian distribution\n "
592
606
" (default is key range / 6)\n "
593
607
" --key-median The median point used in the Gaussian distribution\n "
0 commit comments