I believe its per IP. For example, this reddit phone app I am using, among all users is likely using way more than 30 reqs per second. But for each device the app runs on, the limit is abided.
That part I don't know. I don't have much experience with following rate limits so I'm also interested in the answer.
The guidelines state that each page is cached for 30 seconds so caching on your side would probably be pretty useful.
Besides throttling your users I'm not entirely sure the best way to handle it...
You have to cache data within your server side application. For example if you have a 100 users and they all hit the same reddit resource, you should only have to fetch that resource once very few minutes and serve it to all 100 users.
Even in the api notes it says "Most pages are cached for 30 seconds, so you won't get fresh data if you request the same page that often. Don't hit the same page more than once per 30 seconds."
I believe you get an access token per user, so I imagine those limits are per user as well. I know that's how it works with Github.
The wiki page states that it is "60 requests per minute"
But X-Ratelimit-Remaining shows 600.
And a lot of people here on r/redditdev claim that limit is 1 request per second.
What to believe?
Is it allowed to hit reddit two times in a row?
"/api/v1/me/prefs?fields=over_18"
"/r/subreddit/"
Or should I wait for one second after the first?
*
The rate limiting allows for some level of burstiness - e.g. you could do 10 requests in a second, then wait three minutes, then do 5 requests, then wait 15 seconds, etc.
So there are three fields to look at: X-Ratelimit-Used, X-Ratelimit-Remaining and X-Ratelimit-Reset. The last one is the number of seconds until your next rate limiting period. Feel free to burst ahead of a strict 1 req/sec rate, so long as your Remaining number is above 0 - just be warned that if you get to 0, you'll have to wait for the Reset before making more requests.
Useful Quotes from Rate Limit Documentation
Thread: Reddit API Rate Limit Question
https://www.reddit.com/r/webdev/comments/1z8tqk/reddit_api_rate_limit_question/
I believe its per IP. For example, this reddit phone app I am using, among all users is likely using way more than 30 reqs per second. But for each device the app runs on, the limit is abided.
That part I don't know. I don't have much experience with following rate limits so I'm also interested in the answer.
The guidelines state that each page is cached for 30 seconds so caching on your side would probably be pretty useful.
Besides throttling your users I'm not entirely sure the best way to handle it...
You have to cache data within your server side application. For example if you have a 100 users and they all hit the same reddit resource, you should only have to fetch that resource once very few minutes and serve it to all 100 users.
Even in the api notes it says "Most pages are cached for 30 seconds, so you won't get fresh data if you request the same page that often. Don't hit the same page more than once per 30 seconds."
I believe you get an access token per user, so I imagine those limits are per user as well. I know that's how it works with Github.
Thread: Ratelimit?
https://www.reddit.com/r/redditdev/comments/5wjbkz/ratelimit/
I am confused about reddit OAuth requests limit.
The wiki page states that it is "60 requests per minute"
But X-Ratelimit-Remaining shows 600.
And a lot of people here on r/redditdev claim that limit is 1 request per second.
What to believe?
Is it allowed to hit reddit two times in a row?
"/api/v1/me/prefs?fields=over_18" "/r/subreddit/"
Or should I wait for one second after the first?
*
The rate limiting allows for some level of burstiness - e.g. you could do 10 requests in a second, then wait three minutes, then do 5 requests, then wait 15 seconds, etc.
So there are three fields to look at: X-Ratelimit-Used, X-Ratelimit-Remaining and X-Ratelimit-Reset. The last one is the number of seconds until your next rate limiting period. Feel free to burst ahead of a strict 1 req/sec rate, so long as your Remaining number is above 0 - just be warned that if you get to 0, you'll have to wait for the Reset before making more requests.
More info here: https://github.com/reddit/reddit/wiki/API#rules
*