]> git.saurik.com Git - redis.git/commitdiff
hiredis/redis changes for speed with big payloads: read buffer size set
authorantirez <antirez@gmail.com>
Tue, 8 Nov 2011 09:59:35 +0000 (10:59 +0100)
committerantirez <antirez@gmail.com>
Tue, 8 Nov 2011 09:59:59 +0000 (10:59 +0100)
to 16k, request buffer size is no longer destroyed when emtpy and large
(better fix needed). Redis clients static output buffer set to 16k as
well.

deps/hiredis/hiredis.c
src/redis.h

index b27c63b83868980542287be9988152b5f5f71759..976e94f9ce7801fcf6677df2cda67c2cf9f3cceb 100644 (file)
@@ -520,13 +520,14 @@ void redisReplyReaderFeed(void *reader, const char *buf, size_t len) {
 
     /* Copy the provided buffer. */
     if (buf != NULL && len >= 1) {
+#if 0
         /* Destroy internal buffer when it is empty and is quite large. */
         if (r->len == 0 && sdsavail(r->buf) > 16*1024) {
             sdsfree(r->buf);
             r->buf = sdsempty();
             r->pos = 0;
         }
-
+#endif
         r->buf = sdscatlen(r->buf,buf,len);
         r->len = sdslen(r->buf);
     }
@@ -901,7 +902,7 @@ static void __redisCreateReplyReader(redisContext *c) {
  * After this function is called, you may use redisContextReadReply to
  * see if there is a reply available. */
 int redisBufferRead(redisContext *c) {
-    char buf[2048];
+    char buf[1024*16];
     int nread = read(c->fd,buf,sizeof(buf));
     if (nread == -1) {
         if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
index b5e954fdc3d1625757cb55d0c9d40e19251184d4..8cc2474f4ce4faf8fe39a13fd7e4e270e006fc71 100644 (file)
@@ -49,7 +49,7 @@
 #define REDIS_MAX_WRITE_PER_EVENT (1024*64)
 #define REDIS_REQUEST_MAX_SIZE (1024*1024*256) /* max bytes in inline command */
 #define REDIS_SHARED_INTEGERS 10000
-#define REDIS_REPLY_CHUNK_BYTES (5*1500) /* 5 TCP packets with default MTU */
+#define REDIS_REPLY_CHUNK_BYTES (16*1024) /* 16k output buffer */
 #define REDIS_MAX_LOGMSG_LEN    1024 /* Default maximum length of syslog messages */
 #define REDIS_AUTO_AOFREWRITE_PERC  100
 #define REDIS_AUTO_AOFREWRITE_MIN_SIZE (1024*1024)