New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rough sketch of user quota and bandwidth limiting #1118
Conversation
Quotasimple idea of quota
Use cases
-> three infos stored in moss.users? no nah
** For usage: cluster-wide / soft quota / both user and bucket level / persistent state
|
Other notification style on rate limiting / quota: below are all quotations - Twitter APINote that these HTTP headers are contextual. When using app-only auth, they indicate the rate limit for the application context. When using user-based auth, they indicate the rate limit for that user-application context.
When an application exceeds the rate limit for a given API endpoint, the Twitter API will now return an HTTP 429 “Too Many Requests” response code instead of the variety of codes you would find across the v1’s Search and REST APIs. FoursquarePlease note that rate limits are not per endpoint, but per top-level endpoint group. For example, in an hour, if you make 2,500 userless requests to venues/search and 2,500 userless requests to venues/explore, you would have exhausted your venues/* rate limits for that hour; however, you would still have 500 requests left for tips/*. Generally rate limits follow the rules above; however, some endpoints may have different limits due to security or other considerations. For the most current and accurate rate limit usage information for a particular request type, inspect the X-RateLimit-Remaining and X-RateLimit-Limit HTTP headers of API responses. If you are currently over limits, our API will return a 403 error, and the response object returned by our API will be empty. We will also include a X-RateLimit-Reset header in the response, which is a timestamp that corresponds to when your rate limits will reset. EtsyHeaders: Every API response bears rate limit headers, as described below:
These default rate limits are subject to change at any time, without notice. Calais |
Cse releasenote update
They're done. |
r_t passed for me. I believe it's ready for review. |
%% This is experimental feature. These interfaces and behaviousr | ||
%% may or may not change until general availability. | ||
%% | ||
%% To use 'inherited' your own module, it should be configured in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does inherited
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behaviour implementation.
I need more to please dialyzer |
e7f0b6a
to
f14571c
Compare
I think this is ready for review again. Will run r_t next week, and if we agree on basic ideas, then I'll squash commits and create a cleanly rebased pull request. |
Len when is_integer(Len) -> | ||
case Method of | ||
'PUT' -> Len; | ||
'DELETE' -> - Len |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DELETE request length is almost zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops
get_latest_usage(_Pid, _User, _, N, N) -> {error, notfound}; | ||
get_latest_usage(Pid, User, EndSec, N, Max) -> | ||
End = calendar:gregorian_seconds_to_datetime(EndSec), | ||
ADayAgo = calendar:gregorian_seconds_to_datetime(EndSec - 86400), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If hard coded 86400
is meant for the default value of storage_archive_period
, using application environment value would be better.
Both bw and quota limiter modules work well, great! ☀️ |
Updated ^^; |
Detailed storage stats Reviewed-by: kuenishi
get_latest_usage(Pid, User) -> | ||
Now = calendar:now_to_datetime(os:timestamp()), | ||
NowASec = calendar:datetime_to_gregorian_seconds(Now), | ||
LeewaySeconds = riak_cs_gc:leeway_seconds(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
riak_cs_storage:archive_period()
?
Added the last comment 😅 |
oh, conflicts.... |
Conflicts: src/riak_cs_config.erl src/riak_cs_storage_d.erl
Conflicts resolved. |
Rough sketch of user quota and bandwidth limiting Reviewed-by: shino
@borshop merge |
Release note already written: see an item starting "Module-level hook point for .." in https://github.com/basho/riak_cs/blob/develop/RELEASE-NOTES.md#additions _[posted via JIRA by Kota Uenishi]_ |
riak_cs_quota
is a behaviour where programmers can make thier own module (see callback definition)riak_cs_simple_quota
is a simple quota limiter which takes care of Object putsriak_cs_bw_limitter
is a stupid bandwidth / access rate limitter on objectsriak_cs_simple_quota:help()
for detail usage{quota_modules, [riak_cs_simple_quota, riak_cs_bw_limitter]}
inadvanced.config
For @joecaswell 's review.
Remaining works or notes on usage:
moss.storage
won't scale for many CS nodes