[ 
https://issues.apache.org/jira/browse/HBASE-17331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15760367#comment-15760367
 ] 

ChiaPing Tsai commented on HBASE-17331:
---------------------------------------

bq. You trying to make it all run faster?
No, i'm trying to understand the bottleneck of each builtin tools.
(By the way, [HBASE-15806|https://issues.apache.org/jira/browse/HBASE-15806] is 
ready for reviewing. It may be a faster one.)

bq. How did it show? It was sleeping? And then how does this change manifest? 
Does stuff flow smoother?
The getBytesPerSec() is called frequently when using the bandwidth limit. This 
issue is marked minor because the patch doesn't make significant speedup. But 
we can get some benefit of CPU usage if the value of bandwidth limit is vary 
small...(I am not sure if that is a right way to use)

> Avoid busy waiting in ThrottledInputStream
> ------------------------------------------
>
>                 Key: HBASE-17331
>                 URL: https://issues.apache.org/jira/browse/HBASE-17331
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: ChiaPing Tsai
>            Assignee: ChiaPing Tsai
>            Priority: Minor
>             Fix For: 2.0.0
>
>         Attachments: HBASE-17331.addendum.patch, HBASE-17331.v0.patch, 
> HBASE-17331.v1.patch, HBASE-17331.v2.patch, HBASE-17331.v2.patch
>
>
> {code:title=ThrottledInputStream.java|borderStyle=solid}
> // We can calculate the precise sleep time instead of busy waiting
>   private void throttle() throws IOException {
>     while (getBytesPerSec() > maxBytesPerSec) {
>       try {
>         Thread.sleep(SLEEP_DURATION_MS);
>         totalSleepTime += SLEEP_DURATION_MS;
>       } catch (InterruptedException e) {
>         throw new IOException("Thread aborted", e);
>       }
>     }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to