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 3AF6D10054 for ; Thu, 15 Aug 2013 04:19:35 +0000 (UTC) Received: (qmail 68047 invoked by uid 500); 15 Aug 2013 04:19:34 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 67637 invoked by uid 500); 15 Aug 2013 04:19:33 -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 67627 invoked by uid 99); 15 Aug 2013 04:19:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 04:19:32 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of andrey.kouprianov@gmail.com designates 209.85.212.50 as permitted sender) Received: from [209.85.212.50] (HELO mail-vb0-f50.google.com) (209.85.212.50) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 04:19:26 +0000 Received: by mail-vb0-f50.google.com with SMTP id x14so228505vbb.37 for ; Wed, 14 Aug 2013 21:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=nI46nxNYDJQmDb6Vl0yWvvqDi1QwLR5B3SJ8BEAjxHE=; b=MQkgJax2XOLN6qgXcdG24pWJhwP+LMSjIfJCm0ak8NSIg5m3YJJ2+o3pxwvg/aB7vV ZY4LTpaGGHtcnmKJlDyQIZF4WM3tUlBGLHtRv/gQlYJhOm4aeR5LmoX8vP9b9KcAE+xH vIrnIS0SRPj3eJPe4993GU8pSGXASxqNyG5FEQrjxlqxyGqu83P1FPqsizweWTsnZ/oI WN+WzqhbKHfS9LRxrwrYkjlwGkEMCRcX51jkNEj/8LEDZ07Mo5sNuwqdbtEhHzh42lgY 1Y+3UG3ggv2qCzHR+HpdajanWuSd+0rM3He2kJ1fTuE1P3XSqXFlCsuTUyDeFl8W+blx WMxA== X-Received: by 10.220.174.200 with SMTP id u8mr12669138vcz.6.1376540345198; Wed, 14 Aug 2013 21:19:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.59.4.42 with HTTP; Wed, 14 Aug 2013 21:18:45 -0700 (PDT) In-Reply-To: References: From: Andrey Kuprianov Date: Thu, 15 Aug 2013 11:18:45 +0700 Message-ID: Subject: Re: Erlang vs JavaScript To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=089e0149ca3a4b6e1e04e3f4c606 X-Virus-Checked: Checked by ClamAV on apache.org --089e0149ca3a4b6e1e04e3f4c606 Content-Type: text/plain; charset=ISO-8859-1 Doesnt server performance downgrade, while views are being rebuilt? So the faster they are rebuilt, the better for you. Besides, looks like it's possible to do the same 3 steps with design doc views created in Erlang? Or is it just about using require() in Node.js? On Thu, Aug 15, 2013 at 10:52 AM, Jason Smith wrote: > The time complexity of Erlang vs. JavaScript views is the same, O(n) where > n is the document count. > > View building time feels important during development but it is irrelevant > during operation. Production servers never hold up requests to build views, > so the performance is secondary. For very important views, I prefer > JavaScript because I can unit test them with Node.js. I don't care how long > the view takes if I am not confident about correctness. > > In practice, to use views in production, I use the "PPP trick" (Push, Prep, > Promote). > > ## Push > > 1. Use Node.js to require() my code and run some unit tests on map() and > reduce() > 2. Push the new design document to the server with a new, temporary ID, > e.g. _design/foo-staging > > ## Prep > > 1. Query the view and wait for it to build > 2. (Prep) Confirm the view output, manual or automated. I use more Node.js > tests here > > ## Promote > > 1. curl -I ; curl -I # Upper-case India > 2. Note the new etag and old etag (they are the documents' _rev values) > 3. curl --fail -XCOPY ?rev= > -HDestination:?rev= \ > && curl -XDELETE ?rev= # Promote > > Note that the final step is an atomic operation. From the perspective of > CouchDB clients, you perform an (a) instantaneous upgrade, which is (b) > known to be bug-free, with (c) zero downtime. > > Obviously you can automate this procedure as needed. I do not update design > documents much anymore, so I still use curl in a Bash script. YMMV. > > > On Thu, Aug 15, 2013 at 10:25 AM, Andrey Kuprianov < > andrey.kouprianov@gmail.com> wrote: > > > Yups, also true. > > > > In any case, we'll also be moving towards using Erlang-based design docs > > now. Javascript is great for starters, but once you hit several dozen > > design docs and a few hundred thousand documents, you definitely need > > something faster. > > > > > > On Thu, Aug 15, 2013 at 10:14 AM, Stanley Iriele > >wrote: > > > > > True... But the only way for that to happen is for them to bypass > several > > > other layers of security... In which case I'd have much bigger problems > > to > > > worry about > > > On Aug 14, 2013 8:08 PM, "Andrey Kuprianov" < > andrey.kouprianov@gmail.com > > > > > > wrote: > > > > > > > So far it seems very promising. :) However, what they say can happen > is > > > > that since Erlang code has no sandbox, anything could be done to the > > > system > > > > through design views, if your database is compromised. > > > > > > > > > > > > On Thu, Aug 15, 2013 at 9:58 AM, Stanley Iriele < > siriele2x3@gmail.com > > > > >wrote: > > > > > > > > > 5-6 times eh?...that would give me an honest reason for picking up > > > Erlang > > > > > again....I'm going to try converting all of my views to Erlang and > > see > > > > what > > > > > happens..what's the worst that can happen? :-) > > > > > On Aug 14, 2013 7:55 PM, "Andrey Kuprianov" < > > > andrey.kouprianov@gmail.com > > > > > > > > > > wrote: > > > > > > > > > > > I had a 5-6 times speed boost yesterday, after converting one of > my > > > > > design > > > > > > docs to Erlang. Like a breath of fresh air, if you ask me. > > > > > > > > > > > > Andrey > > > > > > > > > > > > > > > > > > On Wed, Aug 14, 2013 at 11:54 PM, Stanley Iriele < > > > siriele2x3@gmail.com > > > > > > >wrote: > > > > > > > > > > > > > I'm curious... What exactly is the performance gain from > writing > > > > > > > views/shows/ etc in Erlang vs JavaScript... From what I've seen > > the > > > > > > > JavaScript view server is sufficiently fast and feature > complete. > > > > > > > > > > > > > > So my question is this.... Is the Erlang view server that much > > > > > faster?... > > > > > > > Is there another gain that I'm missing?..and is it as feature > > > > complete > > > > > as > > > > > > > the JavaScript equivalent? > > > > > > > > > > > > > > Regards, > > > > > > > > > > > > > > Stanley > > > > > > > > > > > > > > > > > > > > > > > > > > > > --089e0149ca3a4b6e1e04e3f4c606--