Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 15E0C200A5B for ; Wed, 25 May 2016 18:51:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 14C5F160A29; Wed, 25 May 2016 16:51:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 33D7C160A0F for ; Wed, 25 May 2016 18:51:49 +0200 (CEST) Received: (qmail 77641 invoked by uid 500); 25 May 2016 16:51:48 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 77611 invoked by uid 99); 25 May 2016 16:51:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 May 2016 16:51:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D78AF180644 for ; Wed, 25 May 2016 16:39:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id DD5Jl3kmbtQO for ; Wed, 25 May 2016 16:39:27 +0000 (UTC) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 71BC65FCAD for ; Wed, 25 May 2016 16:39:26 +0000 (UTC) Received: by mail-pa0-f50.google.com with SMTP id qo8so19314532pab.1 for ; Wed, 25 May 2016 09:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:message-id:mime-version:subject:date:references:to:in-reply-to; bh=a51gaSVW/lqccDLSwBcAwzMWynrgvxMH0fLcEsrmDmo=; b=Z6/FKHyo6gZxOzr9pSt6pGxloi0ZimZrtHuW2xCdEjIHKwsWt/cDGnMZl9yEYNIMjU /WtlGsiYbD34vjPvB/UHpFzrptGUjqCk2Qc3C9b1f8TU2hIX4HQEuPLWX3cSJaV1Ndn2 HPyYeCp/1auGy0E1mX3+tURPysawgn0ZgLNLcK7VtgaVlyvMUx55cm6aG89TbCkFpyCY WkIl9JiTphj4tkAuu/Un0/1f7ABxOsUX1ewWfXf/qZvPje/2Y3ryicoynl9NN8o70RZC DD04mnkXYv+zpGfYVJM30ruoqPixnYG2eEPUNuPLC5lDN0Nh282nDOixoFaG6grjo1Cx pqnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:mime-version:subject:date :references:to:in-reply-to; bh=a51gaSVW/lqccDLSwBcAwzMWynrgvxMH0fLcEsrmDmo=; b=ECjLsGdFhSetYUxKW4ZxmNydX05KMWDwBKUPvjODgCdRKjkdN9muCP2Bgeyh3uNPLe Bvez0Ze9DOnH5KhihWXymQcqRLyErswqMujCeCe/YxKi53EGQ3TkYb3rucb7YQ979rIN uWmrUvXM7kIkeNcLuO7KB61gjASgPRS1E5Ni1d1JX9pqcE8M8s9rKE0UhKYRnAMhr638 GQ4mfsvxKeAHSTS7d2rRRvPnPlfX2l1FDJ/3dyaQ78VDFLOGshDZkSdCA1APk6E6naXP vV6YmW9TN+7L1wTst1QPynyukisYGhnJbpizS48ufAgQJHq4s1uYgwKbkKKB4cyFCOzy zLFg== X-Gm-Message-State: ALyK8tLP0Ssu0xs1xf4y66U2WcqZ0Hio8ghmvVwE6GeZ/oW9VB3hoBaBkaqZeqYkaHvKgg== X-Received: by 10.66.171.231 with SMTP id ax7mr7107647pac.104.1464194365213; Wed, 25 May 2016 09:39:25 -0700 (PDT) Received: from [10.0.1.2] (66-214-229-209.dhcp.lnbh.ca.charter.com. [66.214.229.209]) by smtp.gmail.com with ESMTPSA id p15sm27484440pfi.67.2016.05.25.09.39.24 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 09:39:24 -0700 (PDT) From: Paul Okstad Content-Type: multipart/alternative; boundary="Apple-Mail=_BA5E4F44-8E4A-4518-B035-E32FAD62DF71" Message-Id: <8ED3123A-2470-4F56-987C-5E46EFBB6871@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: The state of filtered replication Date: Wed, 25 May 2016 09:39:21 -0700 References: <78765234-9DCE-4D77-8267-18342D494051@medicmobile.org> To: user@couchdb.apache.org In-Reply-To: X-Mailer: Apple Mail (2.3124) archived-at: Wed, 25 May 2016 16:51:50 -0000 --Apple-Mail=_BA5E4F44-8E4A-4518-B035-E32FAD62DF71 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 This isn=E2=80=99t just a problem of filtered replication, it=E2=80=99s = a major issue in the database-per-user strategy (at least in the v1.6.1 = I=E2=80=99m using). I=E2=80=99m also using a database-per-user design = with thousands of users and a single global database. If a small = fraction of the users (hundreds) has continuously ongoing replications = from the user DB to the global DB, it will cause extremely high CPU = utilization. This is without any replication filtered javascript = function. Another huge issue with filtered replications is that they lose their = place when replications are restarted. In other words, they don=E2=80=99t = keep track of sequence ID between restarts of the server or stopping and = starting the same replication. So for example, if I want to perform = filtered replication of public documents from the global DB to the = public DB, and I have a ton of documents in global, then each time I = restart the filtered replication it will begin from sequence #1. I=E2=80=99= m guessing this is due to the fact that CouchDB does not know if the = filter function has been modified between replications, but this = behavior is still very disappointing. =E2=80=94=20 Paul Okstad http://pokstad.com > On May 25, 2016, at 4:25 AM, Stefan Klein = wrote: >=20 > 2016-05-25 12:48 GMT+02:00 Stefan du Fresne : >=20 >=20 >=20 >> So to be clear, this is effectively replacing replication=E2=80=94 = where the >> client negotiates with the server for a collection of changes to = download=E2=80=94 >> with a daemon that builds up a collection of documents that each = client >> should get (and also presumably delete), which clients can then query = for >> when they=E2=80=99re able? >>=20 >=20 > Sorry, didn't describe well enough. >=20 > On Serverside we have one big database containing all documents and = one db > for each user. > The clients always replicate to and from their individual userdb, > unfiltered. So the db for a user is a 1:1 copy of their pouchdb/... on > their client. >=20 > Initially we set up a filtered replication for each user from servers = main > database to the server copy of the users database. > With this we ran into performance problems and sooner or later we = probably > would have ran into issues with open file descriptors. >=20 > So what we do instead is listening to the changes of the main database = and > distribute the documents to the servers userdb, which then are synced = with > the clients. >=20 > Note: this is only for documents the users actually work with (as in > possibly modify), for queries on the data we query views on the main > database. >=20 > For the way back, we listen to the _dbchanges, so we get an event for > changes on the users dbs, get that change from the users db and = determine > what to do with it. > We do not replicate back users changes to the main database but rather = have > an internal API to evaluate all kinds of constrains on users input. > If you do not have to check users input, you could certainly listen to > _dbchanges and "blindly" one-shot replicate from the changed DB to = your > main DB. >=20 > --=20 > Stefan --Apple-Mail=_BA5E4F44-8E4A-4518-B035-E32FAD62DF71--