dcapwell commented on code in PR #28:
URL: https://github.com/apache/cassandra-accord/pull/28#discussion_r1092345564
##########
accord-core/src/test/java/accord/impl/basic/DelayedExecutorService.java:
##########
@@ -0,0 +1,107 @@
+package accord.impl.basic;
+
+import accord.burn.random.Decision;
+import accord.burn.random.IntRange;
+import accord.burn.random.RandomInt;
+import accord.burn.random.SegmentedIntRange;
+import org.apache.cassandra.concurrent.FutureTask;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.AbstractExecutorService;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+public class DelayedExecutorService extends AbstractExecutorService
+{
+ private final PendingQueue pending;
+ private final Random random;
+ private final RandomInt jitterInNano;
+
+ public DelayedExecutorService(PendingQueue pending, Random random)
+ {
+ this.pending = pending;
+ this.random = random;
+ this.jitterInNano = new SegmentedIntRange(
+ new IntRange(microToNanos(0), microToNanos(50)),
+ new IntRange(microToNanos(50), msToNanos(5)),
+ // this is different from Apache Cassandra Simulator as this
is computed differently for each executor
Review Comment:
In better understanding `RandomWalkDecision`, the reason for the period
being so low is that we are asking for between 1-10% chance, so we can't have
long periods in order to respect that... for that range here is what I see
```
Number of trues: 4110(4.109999999999999%)
Number of false: 95890(95.89%)
True seq count 0 happened 91999 times
True seq count 1 happened 3689 times
True seq count 2 happened 187 times
True seq count 3 happened 14 times
True seq count 4 happened 1 times
```
switching between 10-20% I see
```
Number of trues: 15340(15.340000000000002%)
Number of false: 84660(84.66%)
True seq count 0 happened 71748 times
True seq count 1 happened 10884 times
True seq count 2 happened 1690 times
True seq count 3 happened 285 times
True seq count 4 happened 44 times
True seq count 5 happened 9 times
```
Using `FixedChance` I see
```
Number of trues: 2909(2.9090000000000003%)
Number of false: 97091(97.09100000000001%)
True seq count 0 happened 94262 times
True seq count 1 happened 2753 times
True seq count 2 happened 72 times
True seq count 3 happened 4 times
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]