mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
benchmarking with different number of LRANGE elements. Ability to change the glue output buffer limit by #define
This commit is contained in:
parent
ccb5332c5e
commit
cc30e368a3
18
benchmark.c
18
benchmark.c
@ -574,6 +574,24 @@ int main(int argc, char **argv) {
|
|||||||
aeMain(config.el);
|
aeMain(config.el);
|
||||||
endBenchmark("LRANGE (first 300 elements)");
|
endBenchmark("LRANGE (first 300 elements)");
|
||||||
|
|
||||||
|
prepareForBenchmark();
|
||||||
|
c = createClient();
|
||||||
|
if (!c) exit(1);
|
||||||
|
c->obuf = sdscat(c->obuf,"LRANGE mylist 0 449\r\n");
|
||||||
|
prepareClientForReply(c,REPLY_MBULK);
|
||||||
|
createMissingClients(c);
|
||||||
|
aeMain(config.el);
|
||||||
|
endBenchmark("LRANGE (first 450 elements)");
|
||||||
|
|
||||||
|
prepareForBenchmark();
|
||||||
|
c = createClient();
|
||||||
|
if (!c) exit(1);
|
||||||
|
c->obuf = sdscat(c->obuf,"LRANGE mylist 0 599\r\n");
|
||||||
|
prepareClientForReply(c,REPLY_MBULK);
|
||||||
|
createMissingClients(c);
|
||||||
|
aeMain(config.el);
|
||||||
|
endBenchmark("LRANGE (first 600 elements)");
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} while(config.loop);
|
} while(config.loop);
|
||||||
|
|
||||||
|
5
redis.c
5
redis.c
@ -1349,6 +1349,7 @@ static void freeClient(redisClient *c) {
|
|||||||
zfree(c);
|
zfree(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GLUEREPLY_UP_TO (1024)
|
||||||
static void glueReplyBuffersIfNeeded(redisClient *c) {
|
static void glueReplyBuffersIfNeeded(redisClient *c) {
|
||||||
int totlen = 0;
|
int totlen = 0;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
@ -1360,10 +1361,10 @@ static void glueReplyBuffersIfNeeded(redisClient *c) {
|
|||||||
totlen += sdslen(o->ptr);
|
totlen += sdslen(o->ptr);
|
||||||
/* This optimization makes more sense if we don't have to copy
|
/* This optimization makes more sense if we don't have to copy
|
||||||
* too much data */
|
* too much data */
|
||||||
if (totlen > 1024) return;
|
if (totlen > GLUEREPLY_UP_TO) return;
|
||||||
}
|
}
|
||||||
if (totlen > 0) {
|
if (totlen > 0) {
|
||||||
char buf[1024];
|
char buf[GLUEREPLY_UP_TO];
|
||||||
int copylen = 0;
|
int copylen = 0;
|
||||||
|
|
||||||
listRewind(c->reply);
|
listRewind(c->reply);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user