mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 23:31:03 +00:00
Re-use variable data in redis-benchmark
This commit is contained in:
parent
53f1d81712
commit
174df6fe49
@ -397,6 +397,7 @@ int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
int i;
|
||||||
client c;
|
client c;
|
||||||
|
|
||||||
signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
@ -440,6 +441,10 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
char *data = zmalloc(config.datasize+1);
|
||||||
|
memset(data,'x',config.datasize);
|
||||||
|
data[config.datasize] = '\0';
|
||||||
|
|
||||||
prepareForBenchmark("PING");
|
prepareForBenchmark("PING");
|
||||||
c = createClient(REDIS_REPLY_STATUS);
|
c = createClient(REDIS_REPLY_STATUS);
|
||||||
c->obuf = sdscat(c->obuf,"PING\r\n");
|
c->obuf = sdscat(c->obuf,"PING\r\n");
|
||||||
@ -457,16 +462,8 @@ int main(int argc, char **argv) {
|
|||||||
prepareForBenchmark("MSET (10 keys, multi bulk)");
|
prepareForBenchmark("MSET (10 keys, multi bulk)");
|
||||||
c = createClient(REDIS_REPLY_ARRAY);
|
c = createClient(REDIS_REPLY_ARRAY);
|
||||||
c->obuf = sdscatprintf(c->obuf,"*%d\r\n$4\r\nMSET\r\n", 11);
|
c->obuf = sdscatprintf(c->obuf,"*%d\r\n$4\r\nMSET\r\n", 11);
|
||||||
{
|
for (i = 0; i < 10; i++) {
|
||||||
int i;
|
c->obuf = sdscatprintf(c->obuf,"$%d\r\n%s\r\n",config.datasize,data);
|
||||||
char *data = zmalloc(config.datasize+1);
|
|
||||||
memset(data,'x',config.datasize);
|
|
||||||
data[config.datasize] = '\0';
|
|
||||||
for (i = 0; i < 10; i++) {
|
|
||||||
c->obuf = sdscatprintf(c->obuf,"$%d\r\n%s\r\n",config.datasize,data);
|
|
||||||
}
|
|
||||||
zfree(data);
|
|
||||||
}
|
|
||||||
createMissingClients(c);
|
createMissingClients(c);
|
||||||
aeMain(config.el);
|
aeMain(config.el);
|
||||||
endBenchmark();
|
endBenchmark();
|
||||||
@ -474,14 +471,7 @@ int main(int argc, char **argv) {
|
|||||||
prepareForBenchmark("SET");
|
prepareForBenchmark("SET");
|
||||||
c = createClient(REDIS_REPLY_STATUS);
|
c = createClient(REDIS_REPLY_STATUS);
|
||||||
c->obuf = sdscat(c->obuf,"*3\r\n$3\r\nSET\r\n$20\r\nfoo_rand000000000000\r\n");
|
c->obuf = sdscat(c->obuf,"*3\r\n$3\r\nSET\r\n$20\r\nfoo_rand000000000000\r\n");
|
||||||
{
|
c->obuf = sdscatprintf(c->obuf,"$%d\r\n%s\r\n",config.datasize,data);
|
||||||
char *data = zmalloc(config.datasize+2);
|
|
||||||
memset(data,'x',config.datasize);
|
|
||||||
data[config.datasize] = '\r';
|
|
||||||
data[config.datasize+1] = '\n';
|
|
||||||
c->obuf = sdscatprintf(c->obuf,"$%d\r\n",config.datasize);
|
|
||||||
c->obuf = sdscatlen(c->obuf,data,config.datasize+2);
|
|
||||||
}
|
|
||||||
createMissingClients(c);
|
createMissingClients(c);
|
||||||
aeMain(config.el);
|
aeMain(config.el);
|
||||||
endBenchmark();
|
endBenchmark();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user