mirror of
https://github.com/fluencelabs/redis
synced 2025-03-31 23:01:03 +00:00
Add wait states to deal with many connections.
This commit is contained in:
parent
1cd3c1e08c
commit
f474a5bd4e
@ -278,11 +278,22 @@ static client createClient(int replytype) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void createMissingClients(client c) {
|
static void createMissingClients(client c) {
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
while(config.liveclients < config.numclients) {
|
while(config.liveclients < config.numclients) {
|
||||||
client new = createClient(c->replytype);
|
client new = createClient(c->replytype);
|
||||||
new->obuf = sdsdup(c->obuf);
|
new->obuf = sdsdup(c->obuf);
|
||||||
if (config.randomkeys) randomizeClientKey(c);
|
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) {
|
static int compareLatency(const void *a, const void *b) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user