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 093C911875 for ; Fri, 27 Jun 2014 18:10:10 +0000 (UTC) Received: (qmail 58876 invoked by uid 500); 27 Jun 2014 18:10:08 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 58826 invoked by uid 500); 27 Jun 2014 18:10:08 -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 58814 invoked by uid 99); 27 Jun 2014 18:10:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2014 18:10:08 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=MIME_QP_LONG_LINE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebastianrothbucher@googlemail.com designates 209.85.212.174 as permitted sender) Received: from [209.85.212.174] (HELO mail-wi0-f174.google.com) (209.85.212.174) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jun 2014 18:10:06 +0000 Received: by mail-wi0-f174.google.com with SMTP id bs8so3258419wib.7 for ; Fri, 27 Jun 2014 11:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=subject:references:from:content-type:in-reply-to:message-id:date:to :content-transfer-encoding:mime-version; bh=HeVKy7qJpYPV72XNN/JC//5UF5Xc6/mf+71hpLXb4X8=; b=i/cVjh9j8rwMIpKMNVhG4pwfRMYFl4OM6QUB1OQoFqqLF1cQSiRetlR1+/50Jkw1B8 M5hMUgZFVddcgCwBZg+7xGH/Nf1Zp3f7ExVHVLcBxEDPxHKB+71yQbhmEcaFRHQgLwNW 9z9lO1SsHcJi1rpfQ2P+QWSwTbXA+HFB2KeIgFkUK6jkvYPFdUEZWY5W9Jbxa7oH4r5X nT9zUoAGDn4k6xP4ToB5xuufr6w80JO7S0md5tLUPTktSoVkOcKOAK3c7yB9ZGjz+e4S 5naMZoWkPWJpy0uTL6BQuQj+QJLN4ZMarwIAEtQZE6XSG11W8yt5rr3yR0d+iIxz9HFi dO9Q== X-Received: by 10.180.20.112 with SMTP id m16mr13660479wie.6.1403892581950; Fri, 27 Jun 2014 11:09:41 -0700 (PDT) Received: from [100.69.91.88] ([46.114.133.91]) by mx.google.com with ESMTPSA id am10sm22839626wjc.45.2014.06.27.11.09.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Jun 2014 11:09:40 -0700 (PDT) Subject: Re: Per-user rate-limiting of writes References: From: Sebastian Rothbucher Content-Type: text/plain; charset=us-ascii X-Mailer: iPhone Mail (11D167) In-Reply-To: Message-Id: <353E2A11-B320-4EE6-A868-1E5FDB34AB92@googlemail.com> Date: Fri, 27 Jun 2014 20:09:40 +0200 To: "user@couchdb.apache.org" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) X-Virus-Checked: Checked by ClamAV on apache.org Hi Suraj, i think the Unit of work for Updates is always one document - and you can no= t know for sure what is going on in parallel.=20 So, either you limit the Updates to the same Doc Or you periodically check for users exceeding the Limit and lock them out - k= nowing that exceeding is temporarily possible although the changes Feed can h= elp minimizing Or you have logic in front of Couch checking against non-stale views That's all i can think of now Good luck! Sebastian=20 Von meinem iPhone gesendet > Am 27.06.2014 um 11:49 schrieb Suraj Kumar : >=20 > Hi, >=20 > We use CouchDB's _users DB extensively for authentication. We'd like to > rate-limit the number of writes to CouchDB per user. How can this be > achieved? One way is to make a web-server do the rate-limiting. But we're > really looking for rate limiting how many docs a given user can have in th= e > system beyond which writes should 'fail'. How can this be done? I can thin= k > of ways to 'keep no more than N docs per user' but I'd ideally like to > inform the user via HTTP response then and there when write rate-limit > threshold has crossed. >=20 > Is this possible? >=20 > Thanks, >=20 > -Suraj >=20 > --=20 > An Onion is the Onion skin and the Onion under the skin until the Onion > Skin without any Onion underneath. >=20 > --=20 > _____________________________________________________________ > The information contained in this communication is intended solely for the= =20 > use of the individual or entity to whom it is addressed and others=20 > authorized to receive it. It may contain confidential or legally privilege= d=20 > information. If you are not the intended recipient you are hereby notified= =20 > that any disclosure, copying, distribution or taking any action in relianc= e=20 > on the contents of this information is strictly prohibited and may be=20 > unlawful. If you have received this communication in error, please notify=20= > us immediately by responding to this email and then delete it from your=20= > system. The firm is neither liable for the proper and complete transmissio= n=20 > of the information contained in this communication nor for any delay in it= s=20 > receipt.