Skip to content

Commit

Permalink
Add wait states to deal with many connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
dspezia authored and pietern committed Dec 18, 2010
1 parent 1cd3c1e commit f474a5b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/redis-benchmark.c
Expand Up @@ -278,11 +278,22 @@ static client createClient(int replytype) {
}

static void createMissingClients(client c) {
int n = 0;

while(config.liveclients < config.numclients) {
client new = createClient(c->replytype);
new->obuf = sdsdup(c->obuf);
if (config.randomkeys) randomizeClientKey(c);

/* Listen backlog is quite limited on most systems */
if (++n > 64) {
usleep(50000);
n = 0;
}
}

/* Start the timer once the connection are established */
config.start = mstime();
}

static int compareLatency(const void *a, const void *b) {
Expand Down

0 comments on commit f474a5b

Please sign in to comment.