Java Code Examples for org.elasticsearch.common.breaker.CircuitBreaker#getUsed()
The following examples show how to use
org.elasticsearch.common.breaker.CircuitBreaker#getUsed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TermsSetTest.java From siren-join with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testCircuitBreakerAdjustmentOnLongTermsSet() { HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService( Settings.builder().build(), new NodeSettingsService(Settings.EMPTY)); CircuitBreaker breaker = hcbs.getBreaker(CircuitBreaker.REQUEST); assertThat(breaker.getUsed(), is(equalTo(0L))); LongTermsSet termsSet = new LongTermsSet(8, hcbs.getBreaker(CircuitBreaker.REQUEST)); long usedMem = breaker.getUsed(); assertThat(usedMem, greaterThan(0L)); for (int i = 0; i < 16; i++) { termsSet.add(i); } assertThat(breaker.getUsed(), greaterThan(usedMem)); termsSet.release(); assertThat(breaker.getUsed(), is(equalTo(0L))); }
Example 2
Source File: TermsSetTest.java From siren-join with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testCircuitBreakerAdjustmentOnIntTermsSet() { HierarchyCircuitBreakerService hcbs = new HierarchyCircuitBreakerService( Settings.builder().build(), new NodeSettingsService(Settings.EMPTY)); CircuitBreaker breaker = hcbs.getBreaker(CircuitBreaker.REQUEST); assertThat(breaker.getUsed(), is(equalTo(0L))); IntegerTermsSet termsSet = new IntegerTermsSet(8, hcbs.getBreaker(CircuitBreaker.REQUEST)); long usedMem = breaker.getUsed(); assertThat(usedMem, greaterThan(0L)); for (int i = 0; i < 16; i++) { termsSet.add(i); } assertThat(breaker.getUsed(), greaterThan(usedMem)); termsSet.release(); assertThat(breaker.getUsed(), is(equalTo(0L))); }
Example 3
Source File: HierarchyCircuitBreakerService.java From crate with Apache License 2.0 | 6 votes |
@Override public CircuitBreakerStats stats(String name) { if (CircuitBreaker.PARENT.equals(name)) { return new CircuitBreakerStats( CircuitBreaker.PARENT, parentSettings.getLimit(), parentUsed(0L), parentTripCount.get(), 1.0 ); } CircuitBreaker breaker = requireNonNull(this.breakers.get(name), "Unknown circuit breaker: " + name); return new CircuitBreakerStats( breaker.getName(), breaker.getLimit(), breaker.getUsed(), breaker.getTrippedCount(), breaker.getOverhead()); }
Example 4
Source File: HierarchyCircuitBreakerService.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public AllCircuitBreakerStats stats() { long parentEstimated = 0; List<CircuitBreakerStats> allStats = new ArrayList<>(); // Gather the "estimated" count for the parent breaker by adding the // estimations for each individual breaker for (CircuitBreaker breaker : this.breakers.values()) { allStats.add(stats(breaker.getName())); parentEstimated += breaker.getUsed(); } // Manually add the parent breaker settings since they aren't part of the breaker map allStats.add(new CircuitBreakerStats(CircuitBreaker.PARENT, parentSettings.getLimit(), parentEstimated, 1.0, parentTripCount.get())); return new AllCircuitBreakerStats(allStats.toArray(new CircuitBreakerStats[allStats.size()])); }
Example 5
Source File: CircuitBreakerIntegrationTest.java From crate with Apache License 2.0 | 5 votes |
@Test public void testQueryBreakerIsDecrementedWhenQueryCompletes() { execute("create table t1 (text string)"); execute("insert into t1 values ('this is some text'), ('other text')"); refresh(); CircuitBreakerService circuitBreakerService = internalCluster().getInstance(CircuitBreakerService.class); CircuitBreaker queryBreaker = circuitBreakerService.getBreaker(HierarchyCircuitBreakerService.QUERY); long breakerBytesUsedBeforeQuery = queryBreaker.getUsed(); execute("select text from t1 group by text"); assertThat(queryBreaker.getUsed(), is(breakerBytesUsedBeforeQuery)); }
Example 6
Source File: HierarchyCircuitBreakerService.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public CircuitBreakerStats stats(String name) { CircuitBreaker breaker = this.breakers.get(name); return new CircuitBreakerStats(breaker.getName(), breaker.getLimit(), breaker.getUsed(), breaker.getOverhead(), breaker.getTrippedCount()); }