@@ -125,6 +125,7 @@ static struct config {
125125 int enable_tracking ;
126126 pthread_mutex_t liveclients_mutex ;
127127 pthread_mutex_t is_updating_slots_mutex ;
128+ int resp3 ; /* use RESP3 */
128129} config ;
129130
130131typedef struct _client {
@@ -751,6 +752,15 @@ static client createClient(char *cmd, size_t len, client from, int thread_id) {
751752 (int )sdslen (config .input_dbnumstr ),config .input_dbnumstr );
752753 c -> prefix_pending ++ ;
753754 }
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+
754764 c -> prefixlen = sdslen (c -> obuf );
755765 /* Append the request itself. */
756766 if (from ) {
@@ -1443,6 +1453,8 @@ int parseOptions(int argc, char **argv) {
14431453 } else if (!strcmp (argv [i ],"-u" ) && !lastarg ) {
14441454 parseRedisUri (argv [++ i ],"redis-benchmark" ,& config .conn_info ,& config .tls );
14451455 config .input_dbnumstr = sdsfromlonglong (config .conn_info .input_dbnum );
1456+ } else if (!strcmp (argv [i ],"-3" )) {
1457+ config .resp3 = 1 ;
14461458 } else if (!strcmp (argv [i ],"-d" )) {
14471459 if (lastarg ) goto invalid ;
14481460 config .datasize = atoi (argv [++ i ]);
@@ -1569,6 +1581,7 @@ int parseOptions(int argc, char **argv) {
15691581" -n <requests> Total number of requests (default 100000)\n"
15701582" -d <size> Data size of SET/GET value in bytes (default 3)\n"
15711583" --dbnum <db> SELECT the specified db number (default 0)\n"
1584+ " -3 Start session in RESP3 protocol mode.\n"
15721585" --threads <num> Enable multi-thread mode.\n"
15731586" --cluster Enable cluster mode.\n"
15741587" If the command is supplied on the command line in cluster\n"
@@ -1742,6 +1755,7 @@ int main(int argc, char **argv) {
17421755 config .is_updating_slots = 0 ;
17431756 config .slots_last_update = 0 ;
17441757 config .enable_tracking = 0 ;
1758+ config .resp3 = 0 ;
17451759
17461760 i = parseOptions (argc ,argv );
17471761 argc -= i ;
0 commit comments