From user-return-13289-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Oct 20 02:45:20 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 54519 invoked from network); 20 Oct 2010 02:45:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Oct 2010 02:45:20 -0000 Received: (qmail 96108 invoked by uid 500); 20 Oct 2010 02:45:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 95941 invoked by uid 500); 20 Oct 2010 02:45:18 -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 95927 invoked by uid 99); 20 Oct 2010 02:45:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Oct 2010 02:45:18 +0000 X-ASF-Spam-Status: No, hits=2.1 required=10.0 tests=DNS_FROM_RFC_BOGUSMX,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.214.180] (HELO mail-iw0-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Oct 2010 02:45:11 +0000 Received: by iwn40 with SMTP id 40so681478iwn.11 for ; Tue, 19 Oct 2010 19:44:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.154.198 with SMTP id r6mr2419512icw.355.1287542689926; Tue, 19 Oct 2010 19:44:49 -0700 (PDT) Received: by 10.42.177.202 with HTTP; Tue, 19 Oct 2010 19:44:49 -0700 (PDT) Date: Tue, 19 Oct 2010 22:44:49 -0400 Message-ID: Subject: Slow filtered _changes feed From: Cory Zue To: user Content-Type: text/plain; charset=ISO-8859-1 Howdy, I'm bringing up a problem I chatted about with a few folks with on IRC today but was unable to solve. My app is using the _changes feed to detect what updates need to go to particular clients (in this case cell phones) based on some filtered information the phones send up in the sync request. The flow looks something like: Phone ---HTTP POST---> Server Server ---filtered _changes---> CouchDB [Server prepares couch results for phone] Server ---Data Payload---> Phone All of the above represents a single HTTP POST and response between the phone and server. The problem I am seeing is that hitting the _changes feed from the server is prohibitively slow, and these requests are timing out before the server can send data back down to the phone. I was led to believe on IRC that changing my filter from javascript to erlang would drastically increase performance, but I'm not observing this at all. In fact the erlang version seems slightly slower. I setup an erlang view server following these instructions: http://wiki.apache.org/couchdb/EnableErlangViews Am I missing something? Is my erlang so bad as to negate the increased performance gain from switching over? Was I lied to? Is my whole approach dumb and do I need to implement filtered caching inside my server and outside of couch? Any thoughts or feedback would be much appreciated. thanks, Cory