@@ -125,6 +125,7 @@ static struct config {
125
125
int enable_tracking ;
126
126
pthread_mutex_t liveclients_mutex ;
127
127
pthread_mutex_t is_updating_slots_mutex ;
128
+ int resp3 ; /* use RESP3 */
128
129
} config ;
129
130
130
131
typedef struct _client {
@@ -751,6 +752,15 @@ static client createClient(char *cmd, size_t len, client from, int thread_id) {
751
752
(int )sdslen (config .input_dbnumstr ),config .input_dbnumstr );
752
753
c -> prefix_pending ++ ;
753
754
}
755
+
756
+ if (config .resp3 ) {
757
+ char * buf = NULL ;
758
+ int len = redisFormatCommand (& buf , "HELLO 3" );
759
+ c -> obuf = sdscatlen (c -> obuf , buf , len );
760
+ free (buf );
761
+ c -> prefix_pending ++ ;
762
+ }
763
+
754
764
c -> prefixlen = sdslen (c -> obuf );
755
765
/* Append the request itself. */
756
766
if (from ) {
@@ -1443,6 +1453,8 @@ int parseOptions(int argc, char **argv) {
1443
1453
} else if (!strcmp (argv [i ],"-u" ) && !lastarg ) {
1444
1454
parseRedisUri (argv [++ i ],"redis-benchmark" ,& config .conn_info ,& config .tls );
1445
1455
config .input_dbnumstr = sdsfromlonglong (config .conn_info .input_dbnum );
1456
+ } else if (!strcmp (argv [i ],"-3" )) {
1457
+ config .resp3 = 1 ;
1446
1458
} else if (!strcmp (argv [i ],"-d" )) {
1447
1459
if (lastarg ) goto invalid ;
1448
1460
config .datasize = atoi (argv [++ i ]);
@@ -1569,6 +1581,7 @@ int parseOptions(int argc, char **argv) {
1569
1581
" -n <requests> Total number of requests (default 100000)\n"
1570
1582
" -d <size> Data size of SET/GET value in bytes (default 3)\n"
1571
1583
" --dbnum <db> SELECT the specified db number (default 0)\n"
1584
+ " -3 Start session in RESP3 protocol mode.\n"
1572
1585
" --threads <num> Enable multi-thread mode.\n"
1573
1586
" --cluster Enable cluster mode.\n"
1574
1587
" If the command is supplied on the command line in cluster\n"
@@ -1742,6 +1755,7 @@ int main(int argc, char **argv) {
1742
1755
config .is_updating_slots = 0 ;
1743
1756
config .slots_last_update = 0 ;
1744
1757
config .enable_tracking = 0 ;
1758
+ config .resp3 = 0 ;
1745
1759
1746
1760
i = parseOptions (argc ,argv );
1747
1761
argc -= i ;
0 commit comments