當前位置: 首頁>>代碼示例>>Java>>正文


Java ExponentialClientBackoffPolicy類代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy的典型用法代碼示例。如果您正苦於以下問題:Java ExponentialClientBackoffPolicy類的具體用法?Java ExponentialClientBackoffPolicy怎麽用?Java ExponentialClientBackoffPolicy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExponentialClientBackoffPolicy類屬於org.apache.hadoop.hbase.client.backoff包,在下文中一共展示了ExponentialClientBackoffPolicy類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupCluster

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@BeforeClass
public static void setupCluster() throws Exception{
  Configuration conf = UTIL.getConfiguration();
  // enable backpressure
  conf.setBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE, true);
  // use the exponential backoff policy
  conf.setClass(ClientBackoffPolicy.BACKOFF_POLICY_CLASS, ExponentialClientBackoffPolicy.class,
    ClientBackoffPolicy.class);
  // turn the memstore size way down so we don't need to write a lot to see changes in memstore
  // load
  conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeBytes);
  // ensure we block the flushes when we are double that flushsize
  conf.setLong(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER, HConstants.DEFAULT_HREGION_MEMSTORE_BLOCK_MULTIPLIER);
  conf.setBoolean(CLIENT_SIDE_METRICS_ENABLED_KEY, true);
  UTIL.startMiniCluster();
  UTIL.createTable(tableName, family);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:TestClientPushback.java

示例2: testResultOrdering

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
/**
 * Make sure that we get results in the order that we expect - backoff for a load of 1 should
 * less than backoff for 10, which should be less than that for 50.
 */
@Test
public void testResultOrdering() {
  Configuration conf = new Configuration(false);
  // make the max timeout really high so we get differentiation between load factors
  conf.setLong(ExponentialClientBackoffPolicy.MAX_BACKOFF_KEY, Integer.MAX_VALUE);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long previous = backoff.getBackoffTime(server, regionname, stats);
  for (int i = 1; i <= 100; i++) {
    update(stats, i);
    long next = backoff.getBackoffTime(server, regionname, stats);
    assertTrue(
        "Previous backoff time" + previous + " >= " + next + ", the next backoff time for " +
            "load " + i, previous < next);
    previous = next;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:TestClientExponentialBackoff.java

示例3: testHeapOccupancyPolicy

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testHeapOccupancyPolicy() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long backoffTime;

  update(stats, 0, 95, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Heap occupancy at low watermark had no effect", backoffTime > 0);

  long previous = backoffTime;
  update(stats, 0, 96, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Increase above low watermark should have increased backoff",
    backoffTime > previous);

  update(stats, 0, 98, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertEquals("We should be using max backoff when at high watermark", backoffTime,
    ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:TestClientExponentialBackoff.java

示例4: testCompactionPressurePolicy

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testCompactionPressurePolicy() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long backoffTime;

  update(stats, 0, 0, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Compaction pressure has no effect", backoffTime == 0);

      long previous = backoffTime;
  update(stats, 0, 0, 50);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Compaction pressure should be bigger",
          backoffTime > previous);

  update(stats, 0, 0, 100);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertEquals("under heavy compaction pressure", backoffTime,
          ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:TestClientExponentialBackoff.java

示例5: setupCluster

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@BeforeClass
public static void setupCluster() throws Exception{
  Configuration conf = UTIL.getConfiguration();
  // enable backpressure
  conf.setBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE, true);
  // use the exponential backoff policy
  conf.setClass(ClientBackoffPolicy.BACKOFF_POLICY_CLASS, ExponentialClientBackoffPolicy.class,
    ClientBackoffPolicy.class);
  // turn the memstore size way down so we don't need to write a lot to see changes in memstore
  // load
  conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeBytes);
  // ensure we block the flushes when we are double that flushsize
  conf.setLong("hbase.hregion.memstore.block.multiplier", 2);

  UTIL.startMiniCluster();
  UTIL.createTable(tableName, family);
}
 
開發者ID:grokcoder,項目名稱:pbase,代碼行數:18,代碼來源:TestClientPushback.java

示例6: testHeapOccupancyPolicy

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testHeapOccupancyPolicy() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long backoffTime;

  update(stats, 0, 95);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Heap occupancy at low watermark had no effect", backoffTime > 0);

  long previous = backoffTime;
  update(stats, 0, 96);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Increase above low watermark should have increased backoff",
    backoffTime > previous);

  update(stats, 0, 98);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertEquals("We should be using max backoff when at high watermark", backoffTime,
    ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF);
}
 
開發者ID:grokcoder,項目名稱:pbase,代碼行數:24,代碼來源:TestClientExponentialBackoff.java

示例7: setupCluster

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@BeforeClass
public static void setupCluster() throws Exception{
  Configuration conf = UTIL.getConfiguration();
  // enable backpressure
  conf.setBoolean(HConstants.ENABLE_CLIENT_BACKPRESSURE, true);
  // use the exponential backoff policy
  conf.setClass(ClientBackoffPolicy.BACKOFF_POLICY_CLASS, ExponentialClientBackoffPolicy.class,
    ClientBackoffPolicy.class);
  // turn the memstore size way down so we don't need to write a lot to see changes in memstore
  // load
  conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, flushSizeBytes);
  // ensure we block the flushes when we are double that flushsize
  conf.setLong(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER, HConstants.DEFAULT_HREGION_MEMSTORE_BLOCK_MULTIPLIER);
  conf.setBoolean(CLIENT_SIDE_METRICS_ENABLED_KEY, true);
  UTIL.startMiniCluster(1);
  UTIL.createTable(tableName, family);
}
 
開發者ID:apache,項目名稱:hbase,代碼行數:18,代碼來源:TestClientPushback.java

示例8: testHeapOccupancyPolicy

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testHeapOccupancyPolicy() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long backoffTime;

  update(stats, 0, 95, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Heap occupancy at low watermark had no effect", backoffTime > 0);

  long previous = backoffTime;
  update(stats, 0, 96, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Increase above low watermark should have increased backoff",
    backoffTime > previous);

  update(stats, 0, 98, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertEquals("We should be using max backoff when at high watermark",
    ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF, backoffTime);
}
 
開發者ID:apache,項目名稱:hbase,代碼行數:24,代碼來源:TestClientExponentialBackoff.java

示例9: testCompactionPressurePolicy

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testCompactionPressurePolicy() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  long backoffTime;

  update(stats, 0, 0, 0);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Compaction pressure has no effect", backoffTime == 0);

      long previous = backoffTime;
  update(stats, 0, 0, 50);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertTrue("Compaction pressure should be bigger",
          backoffTime > previous);

  update(stats, 0, 0, 100);
  backoffTime = backoff.getBackoffTime(server, regionname, stats);
  assertEquals("under heavy compaction pressure",
    ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF, backoffTime);
}
 
開發者ID:apache,項目名稱:hbase,代碼行數:24,代碼來源:TestClientExponentialBackoff.java

示例10: testNulls

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testNulls() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);
  assertEquals(0, backoff.getBackoffTime(null, null, null));

  // server name doesn't matter to calculation, but check it now anyways
  assertEquals(0, backoff.getBackoffTime(server, null, null));
  assertEquals(0, backoff.getBackoffTime(server, regionname, null));

  // check when no stats for the region yet
  ServerStatistics stats = new ServerStatistics();
  assertEquals(0, backoff.getBackoffTime(server, regionname, stats));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:TestClientExponentialBackoff.java

示例11: testMaxLoad

import org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy; //導入依賴的package包/類
@Test
public void testMaxLoad() {
  Configuration conf = new Configuration(false);
  ExponentialClientBackoffPolicy backoff = new ExponentialClientBackoffPolicy(conf);

  ServerStatistics stats = new ServerStatistics();
  update(stats, 100);
  assertEquals(ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF, backoff.getBackoffTime(server,
      regionname, stats));

  // another policy with a different max timeout
  long max = 100;
  conf.setLong(ExponentialClientBackoffPolicy.MAX_BACKOFF_KEY, max);
  ExponentialClientBackoffPolicy backoffShortTimeout = new ExponentialClientBackoffPolicy(conf);
  assertEquals(max, backoffShortTimeout.getBackoffTime(server, regionname, stats));

  // test beyond 100 still doesn't exceed the max
  update(stats, 101);
  assertEquals(ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF, backoff.getBackoffTime(server,
      regionname, stats));
  assertEquals(max, backoffShortTimeout.getBackoffTime(server, regionname, stats));

  // and that when we are below 100, its less than the max timeout
  update(stats, 99);
  assertTrue(backoff.getBackoffTime(server,
      regionname, stats) < ExponentialClientBackoffPolicy.DEFAULT_MAX_BACKOFF);
  assertTrue(backoffShortTimeout.getBackoffTime(server, regionname, stats) < max);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:TestClientExponentialBackoff.java


注:本文中的org.apache.hadoop.hbase.client.backoff.ExponentialClientBackoffPolicy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。