[jira] [Commented] (CASSANDRA-14163) RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter

2018-01-11 Thread Jon Haddad (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-14163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323122#comment-16323122
 ] 

Jon Haddad commented on CASSANDRA-14163:


[~jasobrown] Making you reviewer, thanks for jumping on it faster than me :)

> RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter 
> 
>
> Key: CASSANDRA-14163
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14163
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Core
>Reporter: Nate McCall
>Assignee: Nate McCall
>Priority: Minor
>  Labels: lhf
> Fix For: 3.11.2, 4.0
>
> Attachments: 14163.patch
>
>
> {{o.a.c.net.RateBasedBackPressure#apply}} calls {{getRate()}} on the 
> underlying Guava {{RateLimiter}} several times in quick succession (including 
> as the argument to a non level checked log statement). 
> Said {{getRate()}} method acquires a lock within {{RateLimiter}}, so just 
> getting a local variable reference will remove several calls and thus several 
> lock acquisitions. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org



[jira] [Commented] (CASSANDRA-14163) RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter

2018-01-11 Thread Jason Brown (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-14163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323071#comment-16323071
 ] 

Jason Brown commented on CASSANDRA-14163:
-

+1.

However, for bonus points, if the rate is never changed during the lifetime of 
the {{RateBasedBackPressureState}} (which I believe is the case), perhaps you 
can just memoize the rate value from within the 
{{RateBasedBackPressureState}}'s constructor, and reference that everywhere 
(preferably from {{RateBasedBackPressureState#getBackPressureRateLimit}}

> RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter 
> 
>
> Key: CASSANDRA-14163
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14163
> Project: Cassandra
>  Issue Type: Improvement
>  Components: Core
>Reporter: Nate McCall
>Assignee: Nate McCall
>Priority: Minor
>  Labels: lhf
> Fix For: 3.11.2, 4.0
>
> Attachments: 14163.patch
>
>
> {{o.a.c.net.RateBasedBackPressure#apply}} calls {{getRate()}} on the 
> underlying Guava {{RateLimiter}} several times in quick succession (including 
> as the argument to a non level checked log statement). 
> Said {{getRate()}} method acquires a lock within {{RateLimiter}}, so just 
> getting a local variable reference will remove several calls and thus several 
> lock acquisitions. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

-
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org