Diskless replication: rio fdset target new supports buffering.

To perform a socket write() for each RDB rio API write call was
extremely unefficient, so now rio has minimal buffering capabilities.
Writes are accumulated into a buffer and only when a given limit is
reacehd are actually wrote to the N slaves FDs.

Trivia: rio lacked support for buffering since our targets were:

1) Memory buffers.
2) C standard I/O.

Both were buffered already.
This commit is contained in:
antirez
2014-10-17 11:36:12 +02:00
parent b1337b15b6
commit 10aafdad56
3 changed files with 56 additions and 1 deletions

View File

@ -1425,6 +1425,9 @@ int rdbSaveToSlavesSockets(void) {
redisSetProcTitle("redis-rdb-to-slaves");
retval = rdbSaveRioWithEOFMark(&slave_sockets,NULL);
if (retval == REDIS_OK && rioFlush(&slave_sockets) == 0)
retval = REDIS_ERR;
if (retval == REDIS_OK) {
size_t private_dirty = zmalloc_get_private_dirty();