diff options
author | Didier Spezia <didier.06@gmail.com> | 2010-12-18 10:58:50 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-12-18 12:11:26 +0100 |
commit | f474a5bd4e80157235dac13326edaa99181fb120 (patch) | |
tree | bd01fc1fff74567441c283dc223bc63e15691916 | |
parent | 1cd3c1e08c96dfe4bddd4ef73229dc7b89c4ce2a (diff) | |
download | redis-f474a5bd4e80157235dac13326edaa99181fb120.tar.gz |
Add wait states to deal with many connections.
-rw-r--r-- | src/redis-benchmark.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index ab0d9230c..df3b85fd8 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -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) { |