Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2112A9519 for ; Mon, 28 Nov 2011 10:59:33 +0000 (UTC) Received: (qmail 54270 invoked by uid 500); 28 Nov 2011 10:59:33 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 54137 invoked by uid 500); 28 Nov 2011 10:59:32 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 54129 invoked by uid 500); 28 Nov 2011 10:59:31 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 54126 invoked by uid 99); 28 Nov 2011 10:59:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2011 10:59:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Nov 2011 10:59:28 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id A3FDFC74; Mon, 28 Nov 2011 10:59:07 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Mon, 28 Nov 2011 10:59:07 -0000 Message-ID: <20111128105907.18803.91768@eos.apache.org> Subject: =?utf-8?q?=5BCouchdb_Wiki=5D_Update_of_=22Performance=22_by_FilipeManana?= Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for c= hange notification. The "Performance" page has been changed by FilipeManana: http://wiki.apache.org/couchdb/Performance?action=3Ddiff&rev1=3D11&rev2=3D12 Comment: Added a note about TCP NO_DELAY There is latency overhead making and receiving each request/response. In= general you should do your requests in batches. Most APIs have some mecha= nism to do batches, usually by supplying lists of documents or keys in the = request body. Be careful what size you pick for the batches. The larger t= he batch the more time your client has to spend encoding the items into JSO= N and more time is spent decoding that number of responses. Do some bench= marking with your own configuration and typical data to find the sweet spot= . It is likely to be between one and ten thousand documents. = If you have a fast I/O system then you can also use concurrency - have mu= ltiple requests/responses at the same time. This mitigates the latency inv= olved in assembling JSON, doing the networking and decoding JSON. + = + As of CouchDB 1.1.0, users often report lower write performance of docume= nts compared to older releases. The main reason is that this release ships = with a more recent version of the HTTP server library Mochiweb, which by de= fault sets the TCP socket option ''SO_NODELAY'' to false. This means that s= mall data sent to the TCP socket, like the reply to a document write reques= t (or reading a very small document), will not be sent immediately to the n= etwork - TCP will buffer it for a while hoping that it will be asked to sen= d more data through the same socket data and then send all the data at once= for increased performance. This TCP buffering behaviour can be disabled vi= a the .ini configuration for all sockets. Example: + = + {{{ + [httpd] + socket_options =3D [{nodelay, true}] + }}} + = = =3D View generation =3D Views with the Javascript view server (default) are extremely slow to gen= erate when there are a non-trivial number of documents to process. The gen= eration process won't even saturate a single CPU let alone your I/O. The c= ause is the latency involved in the CouchDB server and seperate couchjs vie= w server, dramatically indicating how important it is to take latency out o= f your implementation.