mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
redis-benchmark: max pipeline length hardcoded limit removed.
This commit is contained in:
parent
6cbfdd9520
commit
346256f933
@ -47,6 +47,7 @@
|
|||||||
#include "zmalloc.h"
|
#include "zmalloc.h"
|
||||||
|
|
||||||
#define REDIS_NOTUSED(V) ((void) V)
|
#define REDIS_NOTUSED(V) ((void) V)
|
||||||
|
#define RANDPTR_INITIAL_SIZE 8
|
||||||
|
|
||||||
static struct config {
|
static struct config {
|
||||||
aeEventLoop *el;
|
aeEventLoop *el;
|
||||||
@ -81,12 +82,13 @@ static struct config {
|
|||||||
typedef struct _client {
|
typedef struct _client {
|
||||||
redisContext *context;
|
redisContext *context;
|
||||||
sds obuf;
|
sds obuf;
|
||||||
char *randptr[32]; /* needed for MSET against 10 keys */
|
char **randptr; /* Pointers to :rand: strings inside the command buf */
|
||||||
size_t randlen;
|
size_t randlen; /* Number of pointers in client->randptr */
|
||||||
unsigned int written; /* bytes of 'obuf' already written */
|
size_t randfree; /* Number of unused pointers in client->randptr */
|
||||||
long long start; /* start time of a request */
|
unsigned int written; /* Bytes of 'obuf' already written */
|
||||||
long long latency; /* request latency */
|
long long start; /* Start time of a request */
|
||||||
int pending; /* Number of pending requests (sent but no reply received) */
|
long long latency; /* Request latency */
|
||||||
|
int pending; /* Number of pending requests (replies to consume) */
|
||||||
int selectlen; /* If non-zero, a SELECT of 'selectlen' bytes is currently
|
int selectlen; /* If non-zero, a SELECT of 'selectlen' bytes is currently
|
||||||
used as a prefix of the pipline of commands. This gets
|
used as a prefix of the pipline of commands. This gets
|
||||||
discarded the first time it's sent. */
|
discarded the first time it's sent. */
|
||||||
@ -306,6 +308,8 @@ static client createClient(char *cmd, size_t len) {
|
|||||||
for (j = 0; j < config.pipeline; j++)
|
for (j = 0; j < config.pipeline; j++)
|
||||||
c->obuf = sdscatlen(c->obuf,cmd,len);
|
c->obuf = sdscatlen(c->obuf,cmd,len);
|
||||||
c->randlen = 0;
|
c->randlen = 0;
|
||||||
|
c->randfree = RANDPTR_INITIAL_SIZE;
|
||||||
|
c->randptr = zmalloc(sizeof(char*)*c->randfree);
|
||||||
c->written = 0;
|
c->written = 0;
|
||||||
c->pending = config.pipeline;
|
c->pending = config.pipeline;
|
||||||
if (c->selectlen) c->pending++;
|
if (c->selectlen) c->pending++;
|
||||||
@ -314,8 +318,12 @@ static client createClient(char *cmd, size_t len) {
|
|||||||
if (config.randomkeys) {
|
if (config.randomkeys) {
|
||||||
char *p = c->obuf;
|
char *p = c->obuf;
|
||||||
while ((p = strstr(p,":rand:")) != NULL) {
|
while ((p = strstr(p,":rand:")) != NULL) {
|
||||||
assert(c->randlen < (signed)(sizeof(c->randptr)/sizeof(char*)));
|
if (c->randfree == 0) {
|
||||||
|
c->randptr = zrealloc(c->randptr,sizeof(char*)*c->randlen*2);
|
||||||
|
c->randfree += c->randlen;
|
||||||
|
}
|
||||||
c->randptr[c->randlen++] = p+6;
|
c->randptr[c->randlen++] = p+6;
|
||||||
|
c->randfree--;
|
||||||
p += 6;
|
p += 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user