Early throttling observed in cluster run with multiple instances of application #201
Replies: 4 comments 29 replies
-
Off-top, I see that you use the highly loaded bucket. Today I have been released the 7.0.0 version that contains significant enhancement for such case #90 . I am very surprised to know that Coherence is able to process 30K TPS on same key, I did not use to believe in such numbers before. You can significantly reduce pressure to the Coherence cluster by migrating to 7.0.0 and migrating the code a bit: ...
@PostConstruct
private void intializeRateLimitService() {
NamedCache cache = CacheFactory.getCache("testMap");
cache.addIndex(new DeserializationAccelerator(IdentityExtractor.INSTANCE()), false, null);
this.bucketProxy = new CoherenceManager(cache);
// optimized bucket is not lightweith so it can be stored somewhere for reuse
this.bucket = bucketProxy.builder()
.withOptimization(Optimizations.batching())
.build(bucketKey, configurationSupplier);
} |
Beta Was this translation helpful? Give feedback.
-
@techdeba901 According to original question: bandwidths.add(Bandwidth.classic(rate, Refill.intervallyAligned(rate, Duration.ofSeconds(durationInSec), instant, true))); You invoke |
Beta Was this translation helpful? Give feedback.
-
we observed from the source code of version 6 that async implementation of bucket depends on the CommonForkJoinPool which can be very less. Is there a way in bucket4j to pass your own executor pool. If not, is there a way to define parallelism for the async methods |
Beta Was this translation helpful? Give feedback.
-
Thanks Vladimir for your inputs. Tokens are added in 100ms when configured rate is 1000 per second (i.e. 100 tokens in every 100ms) when refill strategy is greedy. In tryConsumeAndReturnRemaining, when we use this method it return following 3 variables(remainingTokens , nanosToWaitForRefill, nanosToWaitForReset) in version 7.1.0 What is the difference between nanosToWaitForRefill & nanosToWaitForReset? |
Beta Was this translation helpful? Give feedback.
-
Hi Vladimir,
I am trying to run bucket4j(with coherence) with intervally aligned bucket configuration where tokens are fetched in batch. Batch value is calculated based on incoming message rate(thread calculating this value also aligned with
second). This is running in cluster environment where 20+ instances are running and processing message with same key.
Bucket configuration
rate: 60k TPS
Observation:
At 30k TPS for this message key, throttling starts ~@1.5k. It is not clear why this throttling is happening at such a low rate compared to configured rate in the bucket.
When I used refill strategy as greedy it's behavior improves a little and throttling starts @43k TPS for that key.
Attached the sample code I am using for this run.
Could you please help in understanding what possibly go wrong here?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions