Rate Limit in Dgraph

Hi Team,

Is there a rate limit feature in Dgraph?

4 Likes

Hi abhijit-kar , currently there is no rate limiting in dgraph.
We are working on a RFC for it and will have it soon in graphql though.

Also can you please share scenario you want to use it in, so that we can get more idea of it.

4 Likes

Cool. I got it.

I am making a website for fun & to learn.
I wanted to know the best way to stop user from spamming like & dislike button or any other parts of the website.

So rate limiting + maybe some front end Throttling / Debounce is what I had in mind.

1 Like

Thanks. we will discuss your use case internally.

1 Like

Thank You.

For reference, this is what happens if you try to keep clicking on up-vote buttons more than 2 times in Reddit:

UI checks, like Throttling / Debounce, are great but in case someone finds a way around it …

1 Like

ok, So in that case you require throttling from dgraph side.

1 Like

It’s just a simple way to prevent add/update/query/delete ops from being called more than X times per second. It should be pretty trivial to add this, building off of the @auth directive.

1 Like

@JatinDevDG Is there any update about this rate limiter?

1 Like

I’m investigating replacing our API with dGraph, and I expect we’ll need rate-limiting to do this, as it’s open to external parties and we don’t want them hammering the system (even by mistake).

Is there another way to handle this than rate limiting, or any update on it? @JatinDevDG

Any updates?

Hi @Flam3rboy
I am using this feature:
There is a flag that can limit number of pending mutations:
--raft pending-proposals=256

Number of pending mutation proposals. Useful for rate limiting.
1 Like

Does that rate limit mutation for one ip/user or for the entire database?

@Flam3rboy No it does not work like that. As soon as it has the limited pending proposals(per Alpha) it just returns too many request response to all requests.
What you are looking for can be implemented in Nginx Rate Limiting Module with much less headache.