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

ASF GitHub Bot commented on OMID-50:
------------------------------------

Github user francisco-perez-sorrosal commented on a diff in the pull request:

    https://github.com/apache/incubator-omid/pull/3#discussion_r73977302
  
    --- Diff: tso-server/src/main/java/org/apache/omid/tso/DisruptorModule.java 
---
    @@ -18,14 +18,38 @@
     package org.apache.omid.tso;
     
     import com.google.inject.AbstractModule;
    +import com.google.inject.name.Names;
    +import com.lmax.disruptor.BlockingWaitStrategy;
    +import com.lmax.disruptor.BusySpinWaitStrategy;
    +import com.lmax.disruptor.WaitStrategy;
     
     import javax.inject.Singleton;
     
     public class DisruptorModule extends AbstractModule {
     
    +    private final TSOServerConfig config;
    +
    +    public DisruptorModule(TSOServerConfig config) {
    +        this.config = config;
    +    }
    +
         @Override
         protected void configure() {
    -
    +        switch (config.getWaitStrategyEnum()) {
    +        // A low-cpu usage Disruptor configuration for using in local/test 
environments
    +        case LOW_CPU:
    +             
bind(WaitStrategy.class).annotatedWith(Names.named("PersistenceStrategy")).to(BlockingWaitStrategy.class);
    +             
bind(WaitStrategy.class).annotatedWith(Names.named("ReplyStrategy")).to(BlockingWaitStrategy.class);
    +             
bind(WaitStrategy.class).annotatedWith(Names.named("RetryStrategy")).to(BlockingWaitStrategy.class);
    --- End diff --
    
    I've realized that this should be a `YieldingWaitStrategy` according to the 
current code (see below). So this should be:
    
    ```
      
bind(WaitStrategy.class).annotatedWith(Names.named("RetryStrategy")).to(YieldingWaitStrategy.class);
    ```


> Provide an option to reduce tso-server CPU usage
> ------------------------------------------------
>
>                 Key: OMID-50
>                 URL: https://issues.apache.org/jira/browse/OMID-50
>             Project: Apache Omid
>          Issue Type: Improvement
>            Reporter: Daniel Dai
>            Assignee: Daniel Dai
>             Fix For: 0.8.2.10
>
>         Attachments: OMID-50-1.patch
>
>
> Currently tso-server use 300% cpu even at idle time. The reason for this 300% 
> cpu usage is due to the BusyWaitStrategy used in disruptor. While this is 
> good for throughput, it wastes resources in many use cases. In this ticket, I 
> provide a config to use a different wait strategy and reduce the cpu usage 
> with the option on.



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

Reply via email to