You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Suraj Kumar <su...@inmobi.com> on 2014/06/27 11:49:30 UTC
Per-user rate-limiting of writes
Hi,
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 the
system beyond which writes should 'fail'. How can this be done? I can think
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.
Is this possible?
Thanks,
-Suraj
--
An Onion is the Onion skin and the Onion under the skin until the Onion
Skin without any Onion underneath.
--
_____________________________________________________________
The information contained in this communication is intended solely for the
use of the individual or entity to whom it is addressed and others
authorized to receive it. It may contain confidential or legally privileged
information. If you are not the intended recipient you are hereby notified
that any disclosure, copying, distribution or taking any action in reliance
on the contents of this information is strictly prohibited and may be
unlawful. If you have received this communication in error, please notify
us immediately by responding to this email and then delete it from your
system. The firm is neither liable for the proper and complete transmission
of the information contained in this communication nor for any delay in its
receipt.
Re: Per-user rate-limiting of writes
Posted by Sebastian Rothbucher <se...@googlemail.com>.
Hi Suraj,
i think the Unit of work for Updates is always one document - and you can not know for sure what is going on in parallel.
So, either you limit the Updates to the same Doc
Or you periodically check for users exceeding the Limit and lock them out - knowing that exceeding is temporarily possible although the changes Feed can help 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
Von meinem iPhone gesendet
> Am 27.06.2014 um 11:49 schrieb Suraj Kumar <su...@inmobi.com>:
>
> Hi,
>
> 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 the
> system beyond which writes should 'fail'. How can this be done? I can think
> 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.
>
> Is this possible?
>
> Thanks,
>
> -Suraj
>
> --
> An Onion is the Onion skin and the Onion under the skin until the Onion
> Skin without any Onion underneath.
>
> --
> _____________________________________________________________
> The information contained in this communication is intended solely for the
> use of the individual or entity to whom it is addressed and others
> authorized to receive it. It may contain confidential or legally privileged
> information. If you are not the intended recipient you are hereby notified
> that any disclosure, copying, distribution or taking any action in reliance
> on the contents of this information is strictly prohibited and may be
> unlawful. If you have received this communication in error, please notify
> us immediately by responding to this email and then delete it from your
> system. The firm is neither liable for the proper and complete transmission
> of the information contained in this communication nor for any delay in its
> receipt.