Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0AE61D470 for ; Mon, 4 Feb 2013 22:18:01 +0000 (UTC) Received: (qmail 33769 invoked by uid 500); 4 Feb 2013 22:18:00 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 33698 invoked by uid 500); 4 Feb 2013 22:18:00 -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 Delivered-To: moderator for dev@couchdb.apache.org Received: (qmail 27205 invoked by uid 99); 4 Feb 2013 22:15:29 -0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of natevw@gmail.com designates 209.85.210.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=+Ew2/Q568Dh2iL5kheYkXoGz2ezGcxcE0rdOzgJvfCI=; b=xuGTGTyJe8DHGT4HAHkkKuZrWz9eflEFm/oUZ3haKnd85ZTKjRHuGvN5BzGEqehn0r H3KlriWnT6JPd3G1XFiooD8F5x/A1rzkPWEYFlTxzTtsBeDTt8Dq1goWlTRZMNVeKF4s qPQYc/77W0tEqsehv8Y0NzOGVZmiiDjOWpfBDQG0MoeFYxUkbC37YPzqDPj51/tOpa9d bsl2KK5TQ8ABgBlzg6Ws/iEF7oBCLjc0QPV3KK7jqt7lz2BuF1jmH9krFlb3bg12N83d 9sau7gSpMyG5OE3jVdNv+rryukwW1v7bByW0Q6C8s8w2R2o1GwugQgsqqqtM0/nDdH3r OY4Q== X-Received: by 10.50.16.144 with SMTP id g16mr9519491igd.2.1360016099748; Mon, 04 Feb 2013 14:14:59 -0800 (PST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Apple Message framework v1283) Subject: Re: Half-baked idea: incremental virtual databases From: Nathan Vander Wilt In-Reply-To: <1EE3C606-CD9B-4B3E-BFDE-32795DEBB1DB@calftrail.com> Date: Mon, 4 Feb 2013 14:14:57 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <70278F4A-FD08-4818-89B7-EA1B0AF846F5@gmail.com> References: <1EE3C606-CD9B-4B3E-BFDE-32795DEBB1DB@calftrail.com> To: dev@couchdb.apache.org X-Mailer: Apple Mail (2.1283) X-Virus-Checked: Checked by ClamAV on apache.org On Jan 29, 2013, at 5:53 PM, Nathan Vander Wilt wrote: > So I've heard from both hosting providers that it is fine, but also = managed to take both of their shared services "down" with only about = ~100 users (200 continuous filtered replications). I'm only now at the = point where I have tooling to build out arbitrary large tests on my = local machine to see the stats for myself, but as I understand it the = issue is that every replication needs at least one couchjs process to do = its filtering for it. >=20 > So rather than inactive users mostly just taking up disk space, = they're instead costing a full-fledged process worth of memory and = system resources, each, all the time. As I understand it, this isn't = much better on BigCouch either since the data is scattered =B1 evenly on = each machine, so while the *computation* is spread, each node in the = cluster still needs k*numberOfUsers couchjs processes running. So it's = "scalable" in the sense that traditional databases are scalable: = vertically, by buying machines with more and more memory. >=20 > Again, I am still working on getting a better feel for the costs = involved, but the basic theory with a master-to-N hub is not a great = start: every change needs to be processed by every N replications. So if = a user writes a document that ends up in the master database, every = other user's filter function needs to process that change coming out of = master. Even when N users are generating 0 (instead of M) changes, it's = not doing M*N work but there's still always 2*N open connections and = supporting processes providing a nasty baseline for large values of N. Looks like I was wrong about needing enough RAM for one couchjs process = per replication. CouchDB maintains a pool of (no more than = query_server_config/os_process_limit) couchjs processes and work is = divvied out amongst these as necessary. I found a little meta-discussion = of this system at https://issues.apache.org/jira/browse/COUCHDB-1375 and = the code uses it here = https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_serv= ers.erl#L299 On my laptop, I was able to spin up 250 users without issue. Beyond = that, I start running into =B1 hardcoded system resource limits that = Erlang has under Mac OS X but from what I've seen the only theoretical = scalability issue with going beyond that on Linux/Windows would be = response times, as the worker processes become more and more saturated. It still seems wise to implement tiered replications for communicating = between thousands of *active* user databases, but that seems reasonable = to me. thanks, -natevw=