diff --git a/src/rio.c b/src/rio.c index 93dedf94ff..5f8ae61a4e 100644 --- a/src/rio.c +++ b/src/rio.c @@ -528,7 +528,7 @@ static size_t rioConnsetWrite(rio *r, const void *buf, size_t len) { * parallelize while the kernel is sending data in background to * the TCP socket. */ while (len) { - size_t count = len < 1024 ? len : 1024; + size_t count = len < RIO_CONNSET_WRITE_MAX_CHUNK_SIZE ? len : RIO_CONNSET_WRITE_MAX_CHUNK_SIZE; int broken = 0; for (j = 0; j < r->io.connset.numconns; j++) { if (r->io.connset.state[j] != 0) { diff --git a/src/server.h b/src/server.h index 50ab8e6f30..3943326fd9 100644 --- a/src/server.h +++ b/src/server.h @@ -167,6 +167,11 @@ struct hdr_histogram; * and hold back additional reading based on this factor. */ #define CHILD_COW_DUTY_CYCLE 100 +/* When child process is performing write to connset it iterates on the set + * writing a chunk of the available data to send on each connection. + * This constant defines the maximal size of the chunk to use. */ +#define RIO_CONNSET_WRITE_MAX_CHUNK_SIZE 16384 + /* Instantaneous metrics tracking. */ #define STATS_METRIC_SAMPLES 16 /* Number of samples per metric. */ #define STATS_METRIC_COMMAND 0 /* Number of commands executed. */