iilyak commented on issue #2662: Use `couch_rate` application for `couch_view`
URL: https://github.com/apache/couchdb/pull/2662#issuecomment-599598983
 
 
   > // Creates new rate limiter. Internally couch_rate would look at the 
config to get the rate_limiter module for couch_views as well as know it needs 
to use the ets one for it.
   `RateLimiterState = couch_rate:new(couch_views);`
   
   Are you proposing to make `couch_rate` to be aware of `config` application? 
I.e. you would pass the name of the config section `to couch_rate:new`. 
Something like:
   ```
   -module(couch_rate).
   
   new(ConfigSection) ->
        ModuleStr = config:get(ConfigSection, "rate_limiter", 
"couch_rate_limiter"),
        Options = case config:get(ConfigSection, "rate_limiter_opts", 
undefined) of
           undefined -> DefaultConfig;
           OptionsStr -> couch_rate_config:from_str(OptionsStr)
        end,
   ```
   How we would define default options for the case when rate_limiter_opts key 
is not configured? Would we disable rate_limiter?
   
   > When I look at the couch_views_indexer file it feels to me like the 
couch_views_indexer is having to understand too much of how the rate_limiter 
works.
   
   Are you worried about configuration aspect or API aspect here? Because we 
would have to use `new/success/failure/budget/in` (and either delay or wait) 
APIs anyway for the proposed algorithm to work. We could rename some of the 
function but they are needed. The `new` and `budget` wouldn't be sufficient.
   
   > The other thing is how would we turn the rate_limiter off? If someone is 
happy for all views to go full speed even if it affects other views how would 
we do that?
   
   You would set `budget` to `100` (this is a replacement parameter for 
`couch_views.change_limit` which currently defaults to `100`) and `target` to 
`5000` which is a FDB transaction timeout (or 6000 to be safe).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to