From dev-return-9932-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Wed May 19 06:31:16 2010 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 85780 invoked from network); 19 May 2010 06:31:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 May 2010 06:31:16 -0000 Received: (qmail 71352 invoked by uid 500); 19 May 2010 06:31:16 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 71126 invoked by uid 500); 19 May 2010 06:31:15 -0000 Mailing-List: contact dev-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 dev@couchdb.apache.org Received: (qmail 71118 invoked by uid 99); 19 May 2010 06:31:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 May 2010 06:31:14 +0000 X-ASF-Spam-Status: No, hits=-1442.8 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 May 2010 06:31:13 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o4J6Uqwa028248 for ; Wed, 19 May 2010 06:30:53 GMT Message-ID: <17731849.7081274250652935.JavaMail.jira@thor> Date: Wed, 19 May 2010 02:30:52 -0400 (EDT) From: "Adam Kocoloski (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Created: (COUCHDB-767) do a non-blocking file:sync MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 do a non-blocking file:sync --------------------------- Key: COUCHDB-767 URL: https://issues.apache.org/jira/browse/COUCHDB-767 Project: CouchDB Issue Type: Improvement Components: Database Core Affects Versions: 0.11 Reporter: Adam Kocoloski Fix For: 1.1 I've been taking a close look at couch_file performance in our production systems. One of things I've noticed is that reads are occasionally blocked for a long time by a slow call to file:sync. I think this is unnecessary. I think we could do something like handle_call(sync, From, #file{name=Name}=File) -> spawn_link(fun() -> sync_file(Name, From) end), {noreply, File}; and then sync_file(Name, From) -> {ok, Fd} = file:open(Name, [read, raw]), gen_server:reply(From, file:sync(Fd)), file:close(Fd). Does anyone see a downside to this? Individual clients of couch_file still see exactly the same behavior as before, only readers are not blocked by syncs initiated in the db_updater process. When data needs to be flushed file:sync is _much_ slower than spawning a local process and opening the file again -- in the neighborhood of 1000x slower even on Linux with its less-than-durable use of vanilla fsync. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.