View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.omid.benchmarks.tso;
19  
20  import com.google.inject.AbstractModule;
21  import org.apache.omid.YAMLUtils;
22  import org.apache.omid.benchmarks.utils.IntegerGenerator;
23  import org.apache.omid.metrics.MetricsRegistry;
24  import org.apache.omid.tools.hbase.SecureHBaseConfig;
25  import org.apache.omid.tso.client.OmidClientConfiguration;
26  
27  public class TSOServerBenchmarkConfig extends SecureHBaseConfig {
28  
29      private static final String CONFIG_FILE_NAME = "tso-server-benchmark-config.yml";
30      private static final String DEFAULT_CONFIG_FILE_NAME = "default-tso-server-benchmark-config.yml";
31  
32      private long benchmarkRunLengthInMins;
33  
34      private int txRunners;
35      private int txRateInRequestPerSecond;
36      private long warmUpPeriodInSecs;
37      private IntegerGenerator cellIdGenerator;
38      private int writesetSize;
39      private boolean fixedWritesetSize;
40      private int percentageOfReadOnlyTxs;
41      private long commitDelayInMs;
42  
43      private OmidClientConfiguration omidClientConfiguration;
44      private AbstractModule commitTableStoreModule;
45  
46      private MetricsRegistry metrics;
47  
48      // ----------------------------------------------------------------------------------------------------------------
49      // Instantiation
50      // ----------------------------------------------------------------------------------------------------------------
51  
52      TSOServerBenchmarkConfig() {
53          this(CONFIG_FILE_NAME);
54      }
55  
56      TSOServerBenchmarkConfig(String configFileName) {
57          new YAMLUtils().loadSettings(configFileName, DEFAULT_CONFIG_FILE_NAME, this);
58      }
59  
60      // ----------------------------------------------------------------------------------------------------------------
61      // Getters and setters for config params
62      // ----------------------------------------------------------------------------------------------------------------
63  
64      public long getBenchmarkRunLengthInMins() {
65          return benchmarkRunLengthInMins;
66      }
67  
68      public void setBenchmarkRunLengthInMins(long benchmarkRunLengthInMins) {
69          this.benchmarkRunLengthInMins = benchmarkRunLengthInMins;
70      }
71  
72      public int getTxRunners() {
73          return txRunners;
74      }
75  
76      public void setTxRunners(int txRunners) {
77          this.txRunners = txRunners;
78      }
79  
80      public int getTxRateInRequestPerSecond() {
81          return txRateInRequestPerSecond;
82      }
83  
84      public void setTxRateInRequestPerSecond(int txRateInRequestPerSecond) {
85          this.txRateInRequestPerSecond = txRateInRequestPerSecond;
86      }
87  
88      public long getWarmUpPeriodInSecs() {
89          return warmUpPeriodInSecs;
90      }
91  
92      public void setWarmUpPeriodInSecs(long warmUpPeriodInSecs) {
93          this.warmUpPeriodInSecs = warmUpPeriodInSecs;
94      }
95  
96      public IntegerGenerator getCellIdGenerator() {
97          return cellIdGenerator;
98      }
99  
100     public void setCellIdGenerator(IntegerGenerator cellIdGenerator) {
101         this.cellIdGenerator = cellIdGenerator;
102     }
103 
104     public int getWritesetSize() {
105         return writesetSize;
106     }
107 
108     public void setWritesetSize(int writesetSize) {
109         this.writesetSize = writesetSize;
110     }
111 
112     public boolean isFixedWritesetSize() {
113         return fixedWritesetSize;
114     }
115 
116     public void setFixedWritesetSize(boolean fixedWritesetSize) {
117         this.fixedWritesetSize = fixedWritesetSize;
118     }
119 
120     public int getPercentageOfReadOnlyTxs() {
121         return percentageOfReadOnlyTxs;
122     }
123 
124     public void setPercentageOfReadOnlyTxs(int percentageOfReadOnlyTxs) {
125         this.percentageOfReadOnlyTxs = percentageOfReadOnlyTxs;
126     }
127 
128     public long getCommitDelayInMs() {
129         return commitDelayInMs;
130     }
131 
132     public void setCommitDelayInMs(long commitDelayInMs) {
133         this.commitDelayInMs = commitDelayInMs;
134     }
135 
136     public OmidClientConfiguration getOmidClientConfiguration() {
137         return omidClientConfiguration;
138     }
139 
140     public void setOmidClientConfiguration(OmidClientConfiguration omidClientConfiguration) {
141         this.omidClientConfiguration = omidClientConfiguration;
142     }
143 
144     public AbstractModule getCommitTableStoreModule() {
145         return commitTableStoreModule;
146     }
147 
148     public void setCommitTableStoreModule(AbstractModule commitTableStoreModule) {
149         this.commitTableStoreModule = commitTableStoreModule;
150     }
151 
152     public MetricsRegistry getMetrics() {
153         return metrics;
154     }
155 
156     public void setMetrics(MetricsRegistry metrics) {
157         this.metrics = metrics;
158     }
159 
160 }