Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6624744E2 for ; Tue, 12 Jul 2011 01:53:26 +0000 (UTC) Received: (qmail 69123 invoked by uid 500); 12 Jul 2011 01:53:24 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 69077 invoked by uid 500); 12 Jul 2011 01:53:24 -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 69069 invoked by uid 99); 12 Jul 2011 01:53:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jul 2011 01:53:24 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of geddes.jonathan@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jul 2011 01:53:18 +0000 Received: by ewy28 with SMTP id 28so2157894ewy.11 for ; Mon, 11 Jul 2011 18:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9wYu0iCJMDg9sB9Qd0Ki4zgdUxE3wtEOVkF54a0iD5Y=; b=dLvsUXPHXlc2zrl3g27i7z5CBtg9ffx9in3YwfBDapUN0eD3kt5vqvaNP/HdkFHkGZ +ZKd4VkU/bJGbQVCs0Yj+s88xVAbZjrXqoSDGnpedLrZi2XqWTzekmv4Cn46JGdO4tfO SJqist/HICsyCXMdjwIw04G1b6v4EAeTCtOW4= MIME-Version: 1.0 Received: by 10.14.37.78 with SMTP id x54mr1554292eea.50.1310435575796; Mon, 11 Jul 2011 18:52:55 -0700 (PDT) Received: by 10.14.127.194 with HTTP; Mon, 11 Jul 2011 18:52:55 -0700 (PDT) In-Reply-To: References: <8B350540-5545-4983-9413-68BB920ABC67@supercoders.com.au> Date: Mon, 11 Jul 2011 19:52:55 -0600 Message-ID: Subject: Re: Building substantial "pure" 2 tier CouchApps - feasible? From: Jonathan Geddes To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=90e6ba6153aaff129b04a7d58e26 --90e6ba6153aaff129b04a7d58e26 Content-Type: text/plain; charset=ISO-8859-1 I think the "pure" 2 layer approach is not going to be feasible, to be honest with you. I think a more realistic goal is what some have been calling a 2.1 tier architecture. The 2.1 tier architecture is simply the 2 layers plus some simple utilities *behind* couchdb. What I mean by 'behind' is that the client doesn't interface directly with the utilities, but with couchdb directly, just like the 'pure' architechture. The utilities behind couchdb either: a) listen on the _changes api for certain events and do some processing in the db (wait for image uploads and then crop them and put them back in the database, for example) b) accept requests that come in through couchdb's reverse proxy capabilities [0] and perform something that is beyond the scope of couchdb (large joins over several queries, etc). c) run as an "external process" [2]. In cases a and b, you can use "external os processes"[2] to make sure that the other parts of the system are always running (if they crash, couch will start them again!). In case c, a new process is spawned for each request, so this can be slow. The nice thing about this approach is that you can start slow with a simple couchapp, but know that if needed, your architecture can grow to accommodate essentially any requirements (at the cost of some of the deployment flexibility of a chouchapp). [0] https://github.com/apache/couchdb/commit/11469d902b15145d361f9f7ec66a09ac3d04757c [1] http://wiki.apache.org/couchdb/ExternalProcesses [2] https://github.com/apache/couchdb/commit/c8785113522b8486fab0ba53f2043d94e9b1507f disclaimer: I'm currently exploring the effectiveness of this approach, but I've never seen it to be effective from start to finish! And my app still hasn't grown beyond the simple couchapp model (no extra utilities yet). It's surprising how much fits into the couchapp model! HTH --Jonathan On Mon, Jul 11, 2011 at 7:18 PM, Marcello Nuccio wrote: > I am building a pure couchapp to: > - insert the orders of the clients; > - insert the modifications requested by the clients; > - assign the work to the laboratories; > - track the warehouse. > - etc. > > Not very big, but quite complex because I have many document types and > I must exchange data with lot of legacy systems. > > It is an hard work if you are used to RDMS. The most challenging problems > are: > - how to model the data to keep the couchapp simple, efficient, and > easily interoperable with other system? > - access control: in CouchDB is a brand new world. Everything you > already know on access control is almost useless with CouchDB. > - you will need to write some external utility to do some tasks, not > only for maintenance. > > just my 2cents... > > Marcello > > 2011/7/12 Andrew Stuart (SuperCoders) : > > I'd like to build a rather substantial application, it would be nice to > > build it as a pure 2 tier CouchApp. > > > > How practical is this really? Does anyone have experience building > anything > > big in this way? Or are 2 tier CouchApps really only effective for small > > stuff? > > > > I understand that it very much depends on what the app does, but I'm > trying > > to get a general sense of it. > > > > If pure 2 tier CouchDB apps is an impractical goal then we'll design the > > architecture from the beginning as a 3 tier app and whack in some sort of > > server. > > > > as > > > --90e6ba6153aaff129b04a7d58e26--