mirror of
https://github.com/fluencelabs/redis
synced 2025-04-07 18:08:04 +00:00
redis-benchmark: a few fixes to pipelining implementation.
This commit is contained in:
parent
b9474282f8
commit
f6da155bde
@ -78,7 +78,7 @@ static struct config {
|
|||||||
typedef struct _client {
|
typedef struct _client {
|
||||||
redisContext *context;
|
redisContext *context;
|
||||||
sds obuf;
|
sds obuf;
|
||||||
char *randptr[10]; /* needed for MSET against 10 keys */
|
char *randptr[32]; /* needed for MSET against 10 keys */
|
||||||
size_t randlen;
|
size_t randlen;
|
||||||
unsigned int written; /* bytes of 'obuf' already written */
|
unsigned int written; /* bytes of 'obuf' already written */
|
||||||
long long start; /* start time of a request */
|
long long start; /* start time of a request */
|
||||||
@ -271,13 +271,11 @@ static client createClient(char *cmd, size_t len) {
|
|||||||
|
|
||||||
/* Find substrings in the output buffer that need to be randomized. */
|
/* Find substrings in the output buffer that need to be randomized. */
|
||||||
if (config.randomkeys) {
|
if (config.randomkeys) {
|
||||||
char *p = c->obuf, *newline;
|
char *p = c->obuf;
|
||||||
while ((p = strstr(p,":rand:")) != NULL) {
|
while ((p = strstr(p,":rand:")) != NULL) {
|
||||||
newline = strstr(p,"\r\n");
|
|
||||||
assert(newline-(p+6) == 12); /* 12 chars for randomness */
|
|
||||||
assert(c->randlen < (signed)(sizeof(c->randptr)/sizeof(char*)));
|
assert(c->randlen < (signed)(sizeof(c->randptr)/sizeof(char*)));
|
||||||
c->randptr[c->randlen++] = p+6;
|
c->randptr[c->randlen++] = p+6;
|
||||||
p = newline+2;
|
p += 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +290,7 @@ static void createMissingClients(client c) {
|
|||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
while(config.liveclients < config.numclients) {
|
while(config.liveclients < config.numclients) {
|
||||||
createClient(c->obuf,sdslen(c->obuf));
|
createClient(c->obuf,sdslen(c->obuf)/config.pipeline);
|
||||||
|
|
||||||
/* Listen backlog is quite limited on most systems */
|
/* Listen backlog is quite limited on most systems */
|
||||||
if (++n > 64) {
|
if (++n > 64) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user